From 88ad6d3723cccbcb95d00ad056c3479a1c48fa5d Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Fri, 6 Jan 2012 21:18:36 +0000 Subject: [PATCH] - added a guard on the socket so we only shutdown if not already done so by possibly another thread. --- source/shared_lib/sources/platform/posix/socket.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/shared_lib/sources/platform/posix/socket.cpp b/source/shared_lib/sources/platform/posix/socket.cpp index 3f43af9cf..8ceec4c34 100644 --- a/source/shared_lib/sources/platform/posix/socket.cpp +++ b/source/shared_lib/sources/platform/posix/socket.cpp @@ -959,6 +959,8 @@ void Socket::disconnectSocket() { MutexSafeWrapper safeMutex(dataSynchAccessorRead,CODE_AT_LINE); MutexSafeWrapper safeMutex1(dataSynchAccessorWrite,CODE_AT_LINE); + + if(isSocketValid() == true) { ::shutdown(sock,2); #ifndef WIN32 ::close(sock); @@ -967,6 +969,7 @@ void Socket::disconnectSocket() { ::closesocket(sock); sock = -1; #endif + } safeMutex.ReleaseLock(); safeMutex1.ReleaseLock(); }