wxSocketImpl::Shutdown() doesn't need to be virtual, its implementation can the same in Unix and Win32 versions (events are already disabled by Close() so there is no need to do it again explicitly under Unix)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57611 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-12-27 22:03:34 +00:00
parent 7d66cdccd0
commit 62088a3c3b
3 changed files with 13 additions and 15 deletions

View File

@@ -250,7 +250,11 @@ public:
// it was indeed created // it was indeed created
void Close(); 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 // IO operations

View File

@@ -31,8 +31,6 @@ public:
virtual wxSocketError GetLastError() const; virtual wxSocketError GetLastError() const;
virtual void Shutdown();
virtual int Read(void *buffer, int size); virtual int Read(void *buffer, int size);
virtual int Write(const void *buffer, int size); virtual int Write(const void *buffer, int size);

View File

@@ -174,6 +174,10 @@ int _System soclose(int);
# define GSOCKET_MSG_NOSIGNAL 0 # define GSOCKET_MSG_NOSIGNAL 0
#endif /* MSG_NOSIGNAL */ #endif /* MSG_NOSIGNAL */
// ----------------------------------------------------------------------------
// implementation of thread-safe/reentrant functions if they're missing
// ----------------------------------------------------------------------------
#if wxUSE_THREADS && (defined(HAVE_GETHOSTBYNAME) || defined(HAVE_GETSERVBYNAME)) #if wxUSE_THREADS && (defined(HAVE_GETHOSTBYNAME) || defined(HAVE_GETSERVBYNAME))
# include "wx/thread.h" # include "wx/thread.h"
#endif #endif
@@ -424,6 +428,10 @@ struct servent *wxGetservbyname_r(const char *port, const char *protocol,
return se; return se;
} }
// ============================================================================
// wxSocketImpl implementation
// ============================================================================
/* static */ /* static */
wxSocketImpl *wxSocketImpl::Create(wxSocketBase& wxsocket) 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 wxSocketError wxSocketImplUnix::GetLastError() const
{ {
switch ( errno ) switch ( errno )