Use closesocket() for closing sockets under MSW

If accepting a socket connection failed, wxSocketImpl::Accept() used
close() to close the socket even under MSW, but it can be only used for
the file descriptors there and closesocket() must be used instead for
the sockets.

Add new (private) wxCloseSocket define and use it both here, to fix the
bug, and elsewhere to make the code more clear.

Closes #18407.
This commit is contained in:
Jan Knepper
2019-06-03 22:31:37 +02:00
committed by Vadim Zeitlin
parent b309868930
commit a4f2303361
4 changed files with 7 additions and 3 deletions

View File

@@ -23,6 +23,8 @@
#include "wx/private/fdiomanager.h"
#define wxCloseSocket close
class wxSocketImplUnix : public wxSocketImpl,
public wxFDIOHandler
{
@@ -64,7 +66,7 @@ private:
{
DisableEvents();
close(m_fd);
wxCloseSocket(m_fd);
}
virtual void UnblockAndRegisterWithEventLoop() wxOVERRIDE