- added a guard on the socket so we only shutdown if not already done so by possibly another thread.

This commit is contained in:
Mark Vejvoda 2012-01-06 21:18:36 +00:00
parent d8092d25f6
commit 88ad6d3723

View File

@ -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();
}