realtimenetprots/sipfw/ProfileAgent/Client/Src/SIPRemoteProfile.cpp
branchRCL_3
changeset 6 43c4dec3cb1f
parent 0 307788aac0a8
equal deleted inserted replaced
5:532ef74cdfa0 6:43c4dec3cb1f
    54 // -----------------------------------------------------------------------------
    54 // -----------------------------------------------------------------------------
    55 //
    55 //
    56 TInt RSIPProfile::Connect()
    56 TInt RSIPProfile::Connect()
    57 	{
    57 	{
    58 	TBool stopTrying(EFalse);
    58 	TBool stopTrying(EFalse);
    59     TInt err(KErrNone);
    59     TInt sessionConnectErr(KErrNone);
       
    60     TInt serverStartErr(KErrNone);
    60     const TInt KMaxRetries(10);
    61     const TInt KMaxRetries(10);
    61     TInt retryCount(0);
    62     TInt retryCount(0);
    62     
    63     
    63     while (!stopTrying && retryCount < KMaxRetries)
    64     while (!stopTrying && retryCount < KMaxRetries)
    64         {
    65         {
    65         err = CreateSession(KSipProfileServerName,Version());
    66         sessionConnectErr = CreateSession(KSipProfileServerName,Version());
    66         if ((err != KErrNotFound) && (err != KErrServerTerminated))
    67         if ((sessionConnectErr != KErrNotFound) 
       
    68                 && (sessionConnectErr != KErrServerTerminated))
    67             {
    69             {
    68             stopTrying = ETrue;
    70             stopTrying = ETrue;
    69             }
    71             }
    70         else
    72         else
    71             {
    73             {
    72             err = TSIPProfileServerStarter::Start();
    74             serverStartErr = TSIPProfileServerStarter::Start();
    73             if ((err != KErrNone) && (err != KErrAlreadyExists))
    75             if ((serverStartErr != KErrNone) && (serverStartErr != KErrAlreadyExists))
    74                 {
    76                 {
    75                 stopTrying = ETrue;
    77                 stopTrying = ETrue;
    76                 }
    78                 }
    77             }
    79             }
    78         retryCount++;
    80         retryCount++;
    79 	    }
    81 	    }
    80 	    
    82 	    
    81     iConnected = (err == KErrNone);
    83     iConnected = (sessionConnectErr == KErrNone);
    82     return err;
    84     return sessionConnectErr;
    83 	}
    85 	}
    84 
    86 
    85 // -----------------------------------------------------------------------------
    87 // -----------------------------------------------------------------------------
    86 // RSIPProfile::Close
    88 // RSIPProfile::Close
    87 // -----------------------------------------------------------------------------
    89 // -----------------------------------------------------------------------------