diff --git a/ChangeLog b/ChangeLog index 23f6803d..80d543be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,7 @@ Florian Faber 2008-08-01 Stephane Letz * Fix desallocation of remaining clients when server quits. + * Close remaining client sockets in JackSocketServerChannel::Close. 2008-07-25 Stephane Letz diff --git a/common/JackEngine.cpp b/common/JackEngine.cpp index f443466e..2effc2a1 100644 --- a/common/JackEngine.cpp +++ b/common/JackEngine.cpp @@ -76,7 +76,7 @@ int JackEngine::Close() jack_log("JackEngine::Close"); fChannel.Close(); - // Close (possibly) remaining clients (RT is stopped) + // Close remaining clients (RT is stopped) for (int i = 0; i < CLIENT_NUM; i++) { JackClientInterface* client = fClientTable[i]; if (client) { diff --git a/common/JackSocketServerChannel.cpp b/common/JackSocketServerChannel.cpp index 7701808b..c96fe912 100644 --- a/common/JackSocketServerChannel.cpp +++ b/common/JackSocketServerChannel.cpp @@ -79,6 +79,16 @@ void JackSocketServerChannel::Close() { fThread.Kill(); fRequestListenSocket.Close(); + + // Close remaining client sockets + std::map >::iterator it; + for (it = fSocketTable.begin(); it != fSocketTable.end(); it++) { + pair elem = (*it).second; + JackClientSocket* socket = elem.second; + assert(socket); + socket->Close(); + delete socket; + } } void JackSocketServerChannel::ClientCreate()