[Sofaswitch-svn] [commit] r408 - sofaswitch/trunk/voip
Author: derek Date: Tue May 6 00:43:07 2008 New Revision: 408 Modified: sofaswitch/trunk/voip/comms.cxx sofaswitch/trunk/voip/mymanager.cxx Log: Fix leaks and issues with message instances not closing correctly. Modified: sofaswitch/trunk/voip/comms.cxx ============================================================================== --- sofaswitch/trunk/voip/comms.cxx (original) +++ sofaswitch/trunk/voip/comms.cxx Tue May 6 00:43:07 2008 @@ -280,6 +280,7 @@ Comms *c = (Comms *)GetTheNextMessageFrame(); if (c->IsTerminated()) { delete c; + c = NULL; } return c; } Modified: sofaswitch/trunk/voip/mymanager.cxx ============================================================================== --- sofaswitch/trunk/voip/mymanager.cxx (original) +++ sofaswitch/trunk/voip/mymanager.cxx Tue May 6 00:43:07 2008 @@ -108,7 +108,7 @@ nodesMakingCalls.Initialise(); nodesFinishedCalls.Initialise(); - runningComms.SetPreAllocatedSize(20); + runningComms.SetPreAllocatedSize(10); runningComms.Initialise(); } @@ -596,10 +596,20 @@ void MyManager::RequestNewId(PString & requester) { - Comms *c = runningComms.GetNextComms(); - if (c == NULL) + Comms *c; + PINDEX attempt = 0; + while (attempt < 10) { + c = runningComms.GetNextComms(); + if (c != NULL) + break; + attempt++; + } + if (attempt >= 10) { + cerr << "not good - tried hard to make a running comms" << endl; + cerr << "Give up now" << endl; return; - + } + c->SetRemoteController(requester); nodesMakingCalls.AddNewMessageFrame(c); supervisor.SendThisMessageTo(PString("REQUESTNEWID ") + c->GetOurId(), requester);
participants (1)
-
SofaSWITCH SVN