fotaapplication/fmsclient/src/fmsclient.cpp
changeset 73 ae69c2e8bc34
parent 51 2e64dc50f295
--- a/fotaapplication/fmsclient/src/fmsclient.cpp	Tue Sep 28 17:53:08 2010 +0530
+++ b/fotaapplication/fmsclient/src/fmsclient.cpp	Fri Oct 15 11:46:45 2010 +0530
@@ -95,14 +95,21 @@
 	if( IsSecureClient(FotaStartUp))
 		{
 		FLOG(_L("RFMSClient::OpenL()- Secured client"));
-		res = CreateSession( KFMSServerName,TVersion(1,0,0),2 );
-		if ( res != KErrNone )
-			{
-			FLOG(_L("RFMSClient::OpenL()- session not created"));
-			res = StartServerL();
-			User::LeaveIfError( res );
-			res = CreateSession( KFMSServerName,TVersion(1,0,0),2 );
-			}
+		
+		const int maxRetry(4);
+		TInt retry = maxRetry;
+		do {
+         res = CreateSession( KFMSServerName,TVersion(1,0,0),2 );
+         if (KErrNotFound != res && KErrServerTerminated != res) {
+             retry =0;
+         } else {
+             TRAP(res, StartServerL());
+             if (KErrNone == res || KErrAlreadyExists == res) {
+                 retry =0;
+                 res = CreateSession( KFMSServerName,TVersion(1,0,0),2 );
+             }
+         }
+     } while (--retry > 0);
 		User::LeaveIfError( res );
 		FLOG(_L("RFMSClient::OpenL()- session created"));
 		CRepository* centrep2 = NULL;