phoneclientserver/phoneclient/Src/Session/RPhCltServer.cpp
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
    18 
    18 
    19 
    19 
    20 // INCLUDE FILES
    20 // INCLUDE FILES
    21 #include    <e32math.h>
    21 #include    <e32math.h>
    22 #include    <e32uid.h>
    22 #include    <e32uid.h>
    23 #include    "phclttypes.h" 
    23 #include    "PhCltTypes.h"
    24 #include    "rphcltserver.h" 
    24 #include    "RPhCltServer.h"
    25 #include    "phcltclientserver.h" 
    25 #include    "PhCltClientServer.h"
    26 
    26 
    27 // CONSTANTS
    27 // CONSTANTS
    28 
    28 
    29 // Information of Phone Server Startup failure, used in panic call.
    29 // Information of Phone Server Startup failure, used in panic call.
    30 _LIT( PH_SRV_SU_FAILURE, "PhSrvStartUp" );
    30 _LIT( PH_SRV_SU_FAILURE, "PhSrvStartUp" );
   161 
   161 
   162     // Now wait for the server to start up, and also observe if the server
   162     // Now wait for the server to start up, and also observe if the server
   163     // thread dies for any reason.
   163     // thread dies for any reason.
   164 
   164 
   165 
   165 
   166     TRequestStatus stat;
   166 	TRequestStatus stat;
   167     serverUnitOfExecution.Rendezvous( stat );
   167 	serverUnitOfExecution.Rendezvous( stat );
   168     if ( stat != KRequestPending )
   168  	if ( stat != KRequestPending )
   169         {
   169         {
   170         User::Panic( PH_SRV_SU_FAILURE, EPhSrvStartupFailurePhase1 );
   170         User::Panic( PH_SRV_SU_FAILURE, EPhSrvStartupFailurePhase1 );
   171 
   171 
   172         serverUnitOfExecution.Kill( KErrAbort );    // abort startup
   172  		serverUnitOfExecution.Kill( KErrAbort );	// abort startup
   173         }
   173         }
   174     else
   174  	else
   175         {
   175         {
   176         serverUnitOfExecution.Resume(); // logon ok
   176  		serverUnitOfExecution.Resume();	// logon ok
   177         }
   177         }
   178 
   178 
   179     // wait for start or death
   179     // wait for start or death
   180     User::WaitForRequest( stat ); 
   180  	User::WaitForRequest( stat ); 
   181     // we can't use the 'exit reason' if the server panicked as this
   181  	// we can't use the 'exit reason' if the server panicked as this
   182     // is the panic 'reason' and may be '0' which cannot be distinguished
   182  	// is the panic 'reason' and may be '0' which cannot be distinguished
   183     // from KErrNone
   183  	// from KErrNone
   184     err = ( serverUnitOfExecution.ExitType() == EExitPanic ) 
   184  	err = ( serverUnitOfExecution.ExitType() == EExitPanic ) 
   185         ? KErrGeneral : stat.Int();
   185         ? KErrGeneral : stat.Int();
   186 
   186 
   187     serverUnitOfExecution.Close();
   187     serverUnitOfExecution.Close();
   188 
   188 
   189 
   189