pkiutilities/DeviceToken/Src/Generic/Client/DevTokenClientSession.cpp
branchRCL_3
changeset 5 3b17fc5c9564
parent 0 164170e6151a
equal deleted inserted replaced
1:d5423fbb4f29 5:3b17fc5c9564
    48     const TUidType serverUid(KNullUid, KNullUid, KUidDevTokenServer);
    48     const TUidType serverUid(KNullUid, KNullUid, KUidDevTokenServer);
    49 
    49 
    50     RProcess server;  
    50     RProcess server;  
    51     TInt r = server.Create(KDevTokenServerImg, KNullDesC, serverUid);
    51     TInt r = server.Create(KDevTokenServerImg, KNullDesC, serverUid);
    52     
    52     
    53     RDebug::Print( _L(" StartServer ") );
    53     TRACE_PRINT( "StartServer" );
    54     
    54     
    55     if ( r != KErrNone )
    55     if ( r != KErrNone )
    56         {
    56         {
    57         RDebug::Print( _L("StartServer1 %d"), r );
    57         TRACE_PRINT_NUM("StartServer1 %d", r );
    58         return r;
    58         return r;
    59         }
    59         }
    60 
    60 
    61     // Synchronise with the process to make sure it hasn't died straight away
    61     // Synchronise with the process to make sure it hasn't died straight away
    62     TRequestStatus stat;
    62     TRequestStatus stat;
    70         {
    70         {
    71         // logon OK - start the server
    71         // logon OK - start the server
    72         server.Resume();
    72         server.Resume();
    73         }
    73         }
    74 
    74 
    75     RDebug::Print( _L(" StartServer 2") );
    75     TRACE_PRINT(" StartServer 2");
    76 
    76 
    77     // Wait to synchronise with server - if it dies in the meantime, it
    77     // Wait to synchronise with server - if it dies in the meantime, it
    78     // also gets completed
    78     // also gets completed
    79     User::WaitForRequest(stat); 
    79     User::WaitForRequest(stat); 
    80     
    80     
    81     RDebug::Print( _L(" StartServer 3") );
    81     TRACE_PRINT(" StartServer 3");
    82     // We can't use the 'exit reason' if the server panicked as this
    82     // We can't use the 'exit reason' if the server panicked as this
    83     // is the panic 'reason' and may be '0' which cannot be distinguished
    83     // is the panic 'reason' and may be '0' which cannot be distinguished
    84     // from KErrNone
    84     // from KErrNone
    85     r = (server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int();
    85     r = (server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int();
    86     
    86     
    87     RDebug::Print( _L(" StartServer 4 %d"), r );
    87     TRACE_PRINT_NUM(" StartServer 4 %d", r );
    88     
    88     
    89     server.Close();
    89     server.Close();
    90     return (r);
    90     return (r);
    91     }
    91     }
    92     
    92     
   157 
   157 
   158         TRACE_PRINT("connect");
   158         TRACE_PRINT("connect");
   159         
   159         
   160         if ( r!=KErrNotFound && r!=KErrServerTerminated )
   160         if ( r!=KErrNotFound && r!=KErrServerTerminated )
   161             {
   161             {
   162             RDebug::Print( _L("connect1 %d"), r );
   162             TRACE_PRINT_NUM("connect1 %d", r );
   163             return r; 
   163             return r; 
   164             }
   164             }
   165 
   165 
   166         if (--retry==0)
   166         if (--retry==0)
   167             {
   167             {
   168             RDebug::Print( _L(" connect2 %d"), r );
   168             TRACE_PRINT_NUM(" connect2 %d", r );
   169             return r; 
   169             return r; 
   170             }
   170             }
   171 
   171 
   172         r=StartServer();
   172         r=StartServer();
   173         
   173         
   174         if ( r!=KErrNone && r!=KErrAlreadyExists )
   174         if ( r!=KErrNone && r!=KErrAlreadyExists )
   175             {
   175             {
   176             RDebug::Print( _L(" connect3 %d"), r );
   176             TRACE_PRINT_NUM(" connect3 %d", r );
   177             return r;  
   177             return r;  
   178             }
   178             }
   179 
   179 
   180         }
   180         }
   181     }
   181     }