git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61336
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
private:
// these functions map directly to XtAdd/RemoveInput() or
// gdk_input_add/remove()
private:
// these functions map directly to XtAdd/RemoveInput() or
// gdk_input_add/remove()
- virtual int AddInput(wxSocketImpl *handler, int fd, SocketDir d) = 0;
+ virtual int AddInput(wxSocketImplUnix *handler, int fd, SocketDir d) = 0;
virtual void RemoveInput(int fd) = 0;
};
virtual void RemoveInput(int fd) = 0;
};
gint WXUNUSED(source),
GdkInputCondition condition)
{
gint WXUNUSED(source),
GdkInputCondition condition)
{
- wxSocketImpl * const handler = static_cast<wxSocketImpl *>(data);
+ wxSocketImplUnix * const handler = static_cast<wxSocketImplUnix *>(data);
if ( condition & GDK_INPUT_READ )
if ( condition & GDK_INPUT_READ )
handler->OnReadWaiting();
handler->OnReadWaiting();
+
+ // we could have lost connection while reading in which case we
+ // shouldn't call OnWriteWaiting() as the socket is now closed and it
+ // would assert
+ if ( handler->m_fd == INVALID_SOCKET )
+ return;
+ }
+
if ( condition & GDK_INPUT_WRITE )
handler->OnWriteWaiting();
}
if ( condition & GDK_INPUT_WRITE )
handler->OnWriteWaiting();
}
class GTKSocketManager : public wxSocketInputBasedManager
{
public:
class GTKSocketManager : public wxSocketInputBasedManager
{
public:
- virtual int AddInput(wxSocketImpl *handler, int fd, SocketDir d)
+ virtual int AddInput(wxSocketImplUnix *handler, int fd, SocketDir d)
gint WXUNUSED(source),
GdkInputCondition condition)
{
gint WXUNUSED(source),
GdkInputCondition condition)
{
- wxSocketImpl * const handler = static_cast<wxSocketImpl *>(data);
+ wxSocketImplUnix * const handler = static_cast<wxSocketImplUnix *>(data);
if ( condition & GDK_INPUT_READ )
if ( condition & GDK_INPUT_READ )
handler->OnReadWaiting();
handler->OnReadWaiting();
+
+ // we could have lost connection while reading in which case we
+ // shouldn't call OnWriteWaiting() as the socket is now closed and it
+ // would assert
+ if ( handler->m_fd == INVALID_SOCKET )
+ return;
+ }
+
if ( condition & GDK_INPUT_WRITE )
handler->OnWriteWaiting();
}
if ( condition & GDK_INPUT_WRITE )
handler->OnWriteWaiting();
}
class GTKSocketManager : public wxSocketInputBasedManager
{
public:
class GTKSocketManager : public wxSocketInputBasedManager
{
public:
- virtual int AddInput(wxSocketImpl *handler, int fd, SocketDir d)
+ virtual int AddInput(wxSocketImplUnix *handler, int fd, SocketDir d)
static void wxSocket_Motif_Input(XtPointer data, int *WXUNUSED(fid),
XtInputId *WXUNUSED(id))
{
static void wxSocket_Motif_Input(XtPointer data, int *WXUNUSED(fid),
XtInputId *WXUNUSED(id))
{
- wxSocketImpl * const handler = static_cast<wxSocketImpl *>(data);
+ wxSocketImplUnix * const handler = static_cast<wxSocketImplUnix *>(data);
handler->OnReadWaiting();
}
handler->OnReadWaiting();
}
static void wxSocket_Motif_Output(XtPointer data, int *WXUNUSED(fid),
XtInputId *WXUNUSED(id))
{
static void wxSocket_Motif_Output(XtPointer data, int *WXUNUSED(fid),
XtInputId *WXUNUSED(id))
{
- wxSocketImpl * const handler = static_cast<wxSocketImpl *>(data);
+ wxSocketImplUnix * const handler = static_cast<wxSocketImplUnix *>(data);
handler->OnWriteWaiting();
}
handler->OnWriteWaiting();
}
class MotifSocketManager : public wxSocketInputBasedManager
{
public:
class MotifSocketManager : public wxSocketInputBasedManager
{
public:
- virtual int AddInput(wxSocketImpl *handler, int fd, SocketDir d)
+ virtual int AddInput(wxSocketImplUnix *handler, int fd, SocketDir d)
static void wxSocket_PM_Input(void *data)
{
static void wxSocket_PM_Input(void *data)
{
- wxSocketImpl *handler = static_cast<wxSocketImpl *>(data);
+ wxSocketImplUnix *handler = static_cast<wxSocketImplUnix *>(data);
handler->OnReadWaiting();
}
static void wxSocket_PM_Output(void *data)
{
handler->OnReadWaiting();
}
static void wxSocket_PM_Output(void *data)
{
- wxSocketImpl *handler = static_cast<wxSocketImpl *>(data);
+ wxSocketImplUnix *handler = static_cast<wxSocketImplUnix *>(data);
handler->OnWriteWaiting();
}
handler->OnWriteWaiting();
}
class PMSocketManager : public wxSocketInputBasedManager
{
public:
class PMSocketManager : public wxSocketInputBasedManager
{
public:
- virtual int AddInput(wxSocketImpl *handler, int fd, SocketDir d)
+ virtual int AddInput(wxSocketImplUnix *handler, int fd, SocketDir d)
{
if (d == FD_OUTPUT)
return wxTheApp->AddSocketHandler(fd, wxSockWriteMask,
{
if (d == FD_OUTPUT)
return wxTheApp->AddSocketHandler(fd, wxSockWriteMask,