From 14c8df9ee4aea9f629503668d09d8e5920ae11fa Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Mon, 17 Feb 2014 18:24:32 +0000 Subject: [PATCH] fix for shutdown on Linux (an error message was shown on shutdown) --- src/socket.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/socket.cpp b/src/socket.cpp index 963d5fff..71b2d6f8 100755 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -141,17 +141,21 @@ void CSocket::Close() // closesocket will cause recvfrom to return with an error because the // socket is closed -> then the thread can safely be shut down #ifdef _WIN32 - closesocket ( UdpSocket ); +// TODO also use shutdown of the socket on Windows... +closesocket ( UdpSocket ); #else - close ( UdpSocket ); + shutdown ( UdpSocket, SHUT_RDWR ); #endif } CSocket::~CSocket() { + // cleanup the socket (on Windows the WSA cleanup must also be called) #ifdef _WIN32 - // the Windows socket must be cleanup on shutdown + closesocket ( UdpSocket ); WSACleanup(); +#else + close ( UdpSocket ); #endif }