Added connected clients tracking to BlockingTCPAcceptor. For each new connection a new 'BlockingServerTCPTransport' object is created, but was never released.

The acceptor now stores all the objects in a set, and registers a callback with the client, to be notified when the connection is closed. On notification the client is them removed from the set and the memory is released.
When the acceptor is destroyed, it also closes and deleted all the connected clients.
This commit is contained in:
miha_vitorovic
2011-01-05 13:36:07 +01:00
parent dcc2c83336
commit 0af1781b5e
5 changed files with 79 additions and 11 deletions
@@ -125,12 +125,12 @@ namespace epics {
// check if still acquired
int refs = _owners->size();
if(refs>0) {
ostringstream temp;
char ipAddrStr[48];
ipAddrToA(&_socketAddress->ia, ipAddrStr, sizeof(ipAddrStr));
temp<<"Transport to "<<ipAddrStr<<" still has "<<refs;
temp<<" client(s) active and closing...";
errlogSevPrintf(errlogInfo, temp.str().c_str());
errlogSevPrintf(
errlogInfo,
"Transport to %s still has %d client(s) active and closing...",
ipAddrStr, refs);
set<TransportClient*>::iterator it = _owners->begin();
for(; it!=_owners->end(); it++)