diff --git a/include/wx/private/socket.h b/include/wx/private/socket.h index b830d957ad..d546a91acc 100644 --- a/include/wx/private/socket.h +++ b/include/wx/private/socket.h @@ -250,7 +250,11 @@ public: // it was indeed created void Close(); - virtual void Shutdown(); + // shuts down the writing end of the socket and closes it, this is a more + // graceful way to close + // + // does nothing if the socket wasn't created + void Shutdown(); // IO operations diff --git a/include/wx/unix/private/sockunix.h b/include/wx/unix/private/sockunix.h index 11e512ec15..d51d75f130 100644 --- a/include/wx/unix/private/sockunix.h +++ b/include/wx/unix/private/sockunix.h @@ -31,8 +31,6 @@ public: virtual wxSocketError GetLastError() const; - virtual void Shutdown(); - virtual int Read(void *buffer, int size); virtual int Write(const void *buffer, int size); diff --git a/src/unix/sockunix.cpp b/src/unix/sockunix.cpp index 28aa7ed7db..30a417ecc3 100644 --- a/src/unix/sockunix.cpp +++ b/src/unix/sockunix.cpp @@ -174,6 +174,10 @@ int _System soclose(int); # define GSOCKET_MSG_NOSIGNAL 0 #endif /* MSG_NOSIGNAL */ +// ---------------------------------------------------------------------------- +// implementation of thread-safe/reentrant functions if they're missing +// ---------------------------------------------------------------------------- + #if wxUSE_THREADS && (defined(HAVE_GETHOSTBYNAME) || defined(HAVE_GETSERVBYNAME)) # include "wx/thread.h" #endif @@ -424,6 +428,10 @@ struct servent *wxGetservbyname_r(const char *port, const char *protocol, return se; } +// ============================================================================ +// wxSocketImpl implementation +// ============================================================================ + /* static */ wxSocketImpl *wxSocketImpl::Create(wxSocketBase& wxsocket) { @@ -431,18 +439,6 @@ wxSocketImpl *wxSocketImpl::Create(wxSocketBase& wxsocket) } -/* - * Disallow further read/write operations on this socket, close - * the fd and disable all callbacks. - */ -void wxSocketImplUnix::Shutdown() -{ - /* Don't allow events to fire after socket has been closed */ - DisableEvents(); - - wxSocketImpl::Shutdown(); -} - wxSocketError wxSocketImplUnix::GetLastError() const { switch ( errno )