mirror of
https://github.com/glest/glest-source.git
synced 2025-08-22 16:02:50 +02:00
- added a guard on the socket so we only shutdown if not already done so by possibly another thread.
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user