Fixing the TCPConnector cleanup order in case of a server crash.

This commit is contained in:
miha_vitorovic
2011-01-12 14:23:32 +01:00
parent 2565191fb7
commit 3bd11a1e00
2 changed files with 39 additions and 20 deletions

View File

@@ -145,8 +145,6 @@ namespace epics {
// verify
if(!transport->waitUntilVerified(3.0)) {
transport->close(true);
socket = INVALID_SOCKET;
errlogSevPrintf(
errlogMinor,
"Connection to CA server %s failed to be validated, closing it.",
@@ -164,8 +162,9 @@ namespace epics {
return transport;
} catch(...) {
// close socket, if open
if(socket!=INVALID_SOCKET) epicsSocketDestroy(socket);
if(transport!=NULL)
transport->close(true);
else if(socket!=INVALID_SOCKET) epicsSocketDestroy(socket);
_namedLocker->releaseSynchronizationObject(&address);
throw;
}