Committed a couple of IPC changes I forgot to do
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16928 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_DDE_H_
|
#ifndef _WX_DDE_H_
|
||||||
@@ -49,8 +49,8 @@ class WXDLLEXPORT wxDDEConnection: public wxConnectionBase
|
|||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxDDEConnection)
|
DECLARE_DYNAMIC_CLASS(wxDDEConnection)
|
||||||
public:
|
public:
|
||||||
wxDDEConnection(char *buffer, int size);
|
wxDDEConnection(char *buffer, int size); // use external buffer
|
||||||
wxDDEConnection(void);
|
wxDDEConnection(); // use internal buffer
|
||||||
~wxDDEConnection(void);
|
~wxDDEConnection(void);
|
||||||
|
|
||||||
// Calls that CLIENT can make
|
// Calls that CLIENT can make
|
||||||
@@ -70,9 +70,7 @@ public:
|
|||||||
virtual bool OnDisconnect(void);
|
virtual bool OnDisconnect(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
char* m_bufPtr;
|
|
||||||
wxString m_topicName;
|
wxString m_topicName;
|
||||||
int m_bufSize;
|
|
||||||
wxDDEServer* m_server;
|
wxDDEServer* m_server;
|
||||||
wxDDEClient* m_client;
|
wxDDEClient* m_client;
|
||||||
|
|
||||||
|
@@ -346,12 +346,18 @@ wxTCPConnection::wxTCPConnection () : wxConnectionBase()
|
|||||||
m_codeco = NULL;
|
m_codeco = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTCPConnection::wxTCPConnection(char * WXUNUSED(buffer), int WXUNUSED(size))
|
wxTCPConnection::wxTCPConnection(wxChar *buffer, int size)
|
||||||
|
: wxConnectionBase(buffer, size)
|
||||||
{
|
{
|
||||||
|
m_sock = NULL;
|
||||||
|
m_sockstrm = NULL;
|
||||||
|
m_codeci = NULL;
|
||||||
|
m_codeco = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTCPConnection::~wxTCPConnection ()
|
wxTCPConnection::~wxTCPConnection ()
|
||||||
{
|
{
|
||||||
|
Disconnect();
|
||||||
wxDELETE(m_codeci);
|
wxDELETE(m_codeci);
|
||||||
wxDELETE(m_codeco);
|
wxDELETE(m_codeco);
|
||||||
wxDELETE(m_sockstrm);
|
wxDELETE(m_sockstrm);
|
||||||
@@ -371,10 +377,13 @@ void wxTCPConnection::Compress(bool WXUNUSED(on))
|
|||||||
// Calls that CLIENT can make.
|
// Calls that CLIENT can make.
|
||||||
bool wxTCPConnection::Disconnect ()
|
bool wxTCPConnection::Disconnect ()
|
||||||
{
|
{
|
||||||
|
if ( !GetConnected() )
|
||||||
|
return TRUE;
|
||||||
// Send the the disconnect message to the peer.
|
// Send the the disconnect message to the peer.
|
||||||
m_codeco->Write8(IPC_DISCONNECT);
|
m_codeco->Write8(IPC_DISCONNECT);
|
||||||
m_sock->Notify(FALSE);
|
m_sock->Notify(FALSE);
|
||||||
m_sock->Close();
|
m_sock->Close();
|
||||||
|
SetConnected(false);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -415,10 +424,11 @@ char *wxTCPConnection::Request (const wxString& item, int *size, wxIPCFormat for
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_t s;
|
size_t s;
|
||||||
char *data = NULL;
|
|
||||||
|
|
||||||
s = m_codeci->Read32();
|
s = m_codeci->Read32();
|
||||||
data = new char[s];
|
wxChar *data = GetBufferAtLeast( s );
|
||||||
|
wxASSERT_MSG(data != NULL,
|
||||||
|
_T("Buffer too small in wxTCPConnection::Request") );
|
||||||
m_sockstrm->Read(data, s);
|
m_sockstrm->Read(data, s);
|
||||||
|
|
||||||
if (size)
|
if (size)
|
||||||
@@ -552,12 +562,13 @@ void wxTCPEventHandler::Client_OnRequest(wxSocketEvent &event)
|
|||||||
|
|
||||||
format = (wxIPCFormat)codeci->Read8();
|
format = (wxIPCFormat)codeci->Read8();
|
||||||
size = codeci->Read32();
|
size = codeci->Read32();
|
||||||
data = new char[size];
|
data = connection->GetBufferAtLeast( size );
|
||||||
|
wxASSERT_MSG(data != NULL,
|
||||||
|
_T("Buffer too small in wxTCPEventHandler::Client_OnRequest") );
|
||||||
sockstrm->Read(data, size);
|
sockstrm->Read(data, size);
|
||||||
|
|
||||||
connection->OnExecute (topic_name, data, size, format);
|
connection->OnExecute (topic_name, data, size, format);
|
||||||
|
|
||||||
delete [] data;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IPC_ADVISE:
|
case IPC_ADVISE:
|
||||||
@@ -569,12 +580,13 @@ void wxTCPEventHandler::Client_OnRequest(wxSocketEvent &event)
|
|||||||
item = codeci->ReadString();
|
item = codeci->ReadString();
|
||||||
format = (wxIPCFormat)codeci->Read8();
|
format = (wxIPCFormat)codeci->Read8();
|
||||||
size = codeci->Read32();
|
size = codeci->Read32();
|
||||||
data = new char[size];
|
data = connection->GetBufferAtLeast( size );
|
||||||
|
wxASSERT_MSG(data != NULL,
|
||||||
|
_T("Buffer too small in wxTCPEventHandler::Client_OnRequest") );
|
||||||
sockstrm->Read(data, size);
|
sockstrm->Read(data, size);
|
||||||
|
|
||||||
connection->OnAdvise (topic_name, item, data, size, format);
|
connection->OnAdvise (topic_name, item, data, size, format);
|
||||||
|
|
||||||
delete [] data;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IPC_ADVISE_START:
|
case IPC_ADVISE_START:
|
||||||
@@ -610,13 +622,13 @@ void wxTCPEventHandler::Client_OnRequest(wxSocketEvent &event)
|
|||||||
item = codeci->ReadString();
|
item = codeci->ReadString();
|
||||||
format = (wxIPCFormat)codeci->Read8();
|
format = (wxIPCFormat)codeci->Read8();
|
||||||
size = codeci->Read32();
|
size = codeci->Read32();
|
||||||
data = new wxChar[size];
|
data = connection->GetBufferAtLeast( size );
|
||||||
|
wxASSERT_MSG(data != NULL,
|
||||||
|
_T("Buffer too small in wxTCPEventHandler::Client_OnRequest") );
|
||||||
sockstrm->Read(data, size);
|
sockstrm->Read(data, size);
|
||||||
|
|
||||||
connection->OnPoke (topic_name, item, data, size, format);
|
connection->OnPoke (topic_name, item, data, size, format);
|
||||||
|
|
||||||
delete [] data;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IPC_REQUEST:
|
case IPC_REQUEST:
|
||||||
@@ -648,6 +660,7 @@ void wxTCPEventHandler::Client_OnRequest(wxSocketEvent &event)
|
|||||||
{
|
{
|
||||||
sock->Notify(FALSE);
|
sock->Notify(FALSE);
|
||||||
sock->Close();
|
sock->Close();
|
||||||
|
connection->SetConnected(false);
|
||||||
connection->OnDisconnect();
|
connection->OnDisconnect();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user