dcmofw/dcmoclient/src/dcmoclient.cpp
changeset 73 ae69c2e8bc34
parent 55 1c556dee8eb1
equal deleted inserted replaced
71:d2517372cc44 73:ae69c2e8bc34
    97 // ---------------------------------------------------------------------------
    97 // ---------------------------------------------------------------------------
    98 EXPORT_C TInt RDCMOClient::OpenL()
    98 EXPORT_C TInt RDCMOClient::OpenL()
    99 	{	
    99 	{	
   100 	RDEBUG("RDCMOClient::OpenL()- Begin");
   100 	RDEBUG("RDCMOClient::OpenL()- Begin");
   101 	TInt res = KErrNone;	
   101 	TInt res = KErrNone;	
   102 	res = CreateSession( KDCMOServerName,TVersion(KDCMOServerMajorVersionNumber, KDCMOServerMinorVersionNumber, KDCMOServerBuildVersionNumber), KDCMOServerMessageSlotNumber );
   102 	const int maxRetry(4);
   103 	if ( res == KErrNotFound || res == KErrServerTerminated )
   103 	TInt retry = maxRetry;
   104 		{
   104 	do {
   105 		RDEBUG("RDCMOClient::OpenL()- session not created");
   105         res = CreateSession( KDCMOServerName,TVersion(KDCMOServerMajorVersionNumber, KDCMOServerMinorVersionNumber, KDCMOServerBuildVersionNumber), KDCMOServerMessageSlotNumber );
   106 		res = StartServerL();
   106         if (KErrNotFound != res && KErrServerTerminated != res) {
   107 		User::LeaveIfError( res );
   107             retry =0;
   108 		res = CreateSession( KDCMOServerName,TVersion(KDCMOServerMajorVersionNumber, KDCMOServerMinorVersionNumber, KDCMOServerBuildVersionNumber), KDCMOServerMessageSlotNumber );
   108         } else {
   109 		}
   109             TRAP(res, StartServerL());
   110 	User::LeaveIfError( res );
   110             if (KErrNone == res || KErrAlreadyExists == res) {
       
   111                 retry =0;
       
   112                 res = CreateSession( KDCMOServerName,TVersion(KDCMOServerMajorVersionNumber, KDCMOServerMinorVersionNumber, KDCMOServerBuildVersionNumber), KDCMOServerMessageSlotNumber );
       
   113             }
       
   114         }
       
   115     } while (--retry > 0);
       
   116 	User::LeaveIfError( res );	
   111 	RDEBUG_2("RDCMOClient::OpenL()- End with Errorcode as %d",res);	
   117 	RDEBUG_2("RDCMOClient::OpenL()- End with Errorcode as %d",res);	
   112 	return res;
   118 	return res;
   113 	}
   119 	}
   114 
   120 
   115 // ---------------------------------------------------------------------------
   121 // ---------------------------------------------------------------------------