osaf/services/saf/immsv/immnd/ImmModel.cc |  20 ++++++--------------
 1 files changed, 6 insertions(+), 14 deletions(-)


While iterating through sCcbVector, if find any ccb terminated more than 5 
minutes,
collect the garbage immediately.
We don't need to push the ccb to ccbsToGc and delay the garbage collection.

diff --git a/osaf/services/saf/immsv/immnd/ImmModel.cc 
b/osaf/services/saf/immsv/immnd/ImmModel.cc
--- a/osaf/services/saf/immsv/immnd/ImmModel.cc
+++ b/osaf/services/saf/immsv/immnd/ImmModel.cc
@@ -13739,7 +13739,6 @@ ImmModel::cleanTheBasement(InvocVector& 
     ContinuationMap2::iterator ci2;
     ImplementerEvtMap::iterator iem;
     CcbVector::iterator i3;
-    CcbVector ccbsToGc;
     SaUint32T ccbsStuck=0; /* 0 or 1 */
     SaUint32T pbeRtRegress=0; /* 0 or 2 */
     
@@ -13778,15 +13777,17 @@ ImmModel::cleanTheBasement(InvocVector& 
     //Conclusion: I should add cleanup logic here anyway, since it is easy to
     //do and solves the problem. 
 
-    
-    for(i3=sCcbVector.begin(); i3!=sCcbVector.end(); ++i3) {
+    i3 = sCcbVector.begin();
+    while (i3 != sCcbVector.end()) {
         if((*i3)->mState > IMM_CCB_CRITICAL) {
             /* Garbage Collect ccbInfo more than five minutes old */
             if((*i3)->mWaitStartTime && (now - (*i3)->mWaitStartTime >= 300)) {
                 TRACE_5("Removing CCB %u terminated more than 5 minutes ago", 
                     (*i3)->mId);
                 (*i3)->mState = IMM_CCB_ILLEGAL;
-                ccbsToGc.push_back(*i3);
+                delete (*i3);
+                i3 = sCcbVector.erase(i3);
+                continue;
             }
         } else if(iAmCoord) {
             //Fetch CcbIds for Ccbs that have waited too long on an implementer
@@ -13858,6 +13859,7 @@ ImmModel::cleanTheBasement(InvocVector& 
                 }
             }
         }
+        ++i3;
     }
 
     if(sAbortNonCriticalCcbs) {
@@ -13865,16 +13867,6 @@ ImmModel::cleanTheBasement(InvocVector& 
         sAbortNonCriticalCcbs = false; /* Reset. */
     }
 
-    while((i3 = ccbsToGc.begin()) != ccbsToGc.end()) {
-        CcbInfo* ccb = (*i3);
-        ccbsToGc.erase(i3);
-        i3 = std::find_if(sCcbVector.begin(), sCcbVector.end(),
-            CcbIdIs(ccb->mId));
-        osafassert(i3 != sCcbVector.end());
-        sCcbVector.erase(i3);
-        delete (ccb);
-    }
-
     ci2=sPbeRtReqContinuationMap.begin(); 
     while(ci2!=sPbeRtReqContinuationMap.end()) {
         //Timeout on PRT request continuation is hardwired but long.

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://sdm.link/zohomanageengine
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to