- 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 safeMutex(dataSynchAccessorRead,CODE_AT_LINE);
MutexSafeWrapper safeMutex1(dataSynchAccessorWrite,CODE_AT_LINE); MutexSafeWrapper safeMutex1(dataSynchAccessorWrite,CODE_AT_LINE);
if(isSocketValid() == true) {
::shutdown(sock,2); ::shutdown(sock,2);
#ifndef WIN32 #ifndef WIN32
::close(sock); ::close(sock);
@@ -967,6 +969,7 @@ void Socket::disconnectSocket() {
::closesocket(sock); ::closesocket(sock);
sock = -1; sock = -1;
#endif #endif
}
safeMutex.ReleaseLock(); safeMutex.ReleaseLock();
safeMutex1.ReleaseLock(); safeMutex1.ReleaseLock();
} }