realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileCacheItem.cpp
branchRCL_3
changeset 16 43c4dec3cb1f
parent 9 1e1cc61f56c3
child 20 a7d1e54a7332
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileCacheItem.cpp	Wed Apr 14 16:19:40 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileCacheItem.cpp	Tue Apr 27 17:00:49 2010 +0300
@@ -183,7 +183,7 @@
 	{
 	iProfile->SetLastRegistrationError(KErrNoMemory);
 	iCurrentState->RefreshIAPsFailed(*this);
-	SwitchToUnregisteredState();
+	SwitchToUnregisteredState(EFalse);
 	PassAlrErrorToClient(KErrNoMemory, Profile().IapId());
 	}
 
@@ -764,9 +764,12 @@
 	if (iCurrentState->ErrorOccurred(*this, aError))
 		{
 		PROFILE_DEBUG1("ProfileCacheItem::HandleError go unregistered")
-
-		SwitchToUnregisteredState();
-
+		        
+        if(SwitchToUnregisteredState(ETrue))
+            {
+            return EFalse;
+            }		
+		
 		if (aError != KErrNone)
 			{
 			iProfile->SetLastRegistrationError(aError);
@@ -1279,16 +1282,29 @@
 // would register again (if auto-registration on).
 // -----------------------------------------------------------------------------
 //
-void CSIPProfileCacheItem::SwitchToUnregisteredState()
+TBool CSIPProfileCacheItem::SwitchToUnregisteredState(TBool aResume)
 	{
 	CSIPProfileState& unregistered = iServerCore.UnregisteredState();
 	iProfile->SetStatus(unregistered.Name());
 	iCurrentState = &unregistered;
-	SetSnapRetryCounter(0);
-
+	
+    if(iQueuedProfile)
+        {
+        if(aResume)
+            {
+            TRAPD(err, ResumeL());
+            if(KErrNone == err)
+                return ETrue;
+            }
+        delete iProfile;
+        iProfile = iQueuedProfile;
+        iQueuedProfile = NULL;            
+        }
 	// No need to monitor SNAP anymore.
+    SetSnapRetryCounter(0);
 	StopSnapMonitoring();
 	RemoveAllUsers();
+	return EFalse;
 	}
 
 // -----------------------------------------------------------------------------