mtpfws/mtpfw/src/cmtpconnection.cpp
branchRCL_3
changeset 58 142dacf7b30e
parent 45 74aa6861c87d
--- a/mtpfws/mtpfw/src/cmtpconnection.cpp	Wed Sep 15 13:07:27 2010 +0300
+++ b/mtpfws/mtpfw/src/cmtpconnection.cpp	Wed Oct 13 15:29:02 2010 +0300
@@ -82,9 +82,17 @@
     __FLOG(_L8("~CMTPConnection - Entry"));
     CloseAllSessions();
     
-	//remove all events
-    DequeueAllEvents();
-	
+    // Remove any events not associated 
+    // with a session
+    TSglQueIter<CMTPEventLink> iter(iEventQ);
+    iter.SetToFirst();
+    CMTPEventLink* link = NULL;
+    
+    while ((link = iter++) != NULL)
+    	{
+    	delete link;
+    	}
+    
     iSessions.ResetAndDestroy();
     
     if (iTransportConnection != NULL)
@@ -659,16 +667,9 @@
     DequeueEvent(iEventQ.First());       
    	if (iPendingEventCount > 0)
    		{
-		if (NULL != iTransportConnection)
-			{
-			// Forward the event to the transport connection layer.
-			__FLOG(_L8("Sending queued event"));
-			iTransportConnection->SendEventL(iEventQ.First()->iEvent);
-			}
-		else
-			{
-			DequeueAllEvents();
-			}
+   		// Forward the event to the transport connection layer.
+   		__FLOG(_L8("Sending queued event"));
+ 	    iTransportConnection->SendEventL(iEventQ.First()->iEvent);
    		}
     
     __FLOG(_L8("SendEventCompleteL - Exit"));
@@ -1045,19 +1046,6 @@
     __FLOG(_L8("RemoveEventsForSession - Exit"));
 	}
 
-void CMTPConnection::DequeueAllEvents()
-	{
-	TSglQueIter<CMTPEventLink> iter(iEventQ);
-    iter.SetToFirst();
-    CMTPEventLink* link = NULL;
-    
-    while ((link = iter++) != NULL)
-    	{
-    	delete link;
-    	}
-	iPendingEventCount = 0;
-	}
-	
 void CMTPConnection::DequeueEvent(CMTPEventLink* aLink)
 	{
 	iEventQ.Remove(*aLink);