--- a/watchdog/src/watchdog.cpp Fri Mar 12 15:44:28 2010 +0200
+++ b/watchdog/src/watchdog.cpp Mon Mar 15 12:42:24 2010 +0200
@@ -89,20 +89,35 @@
PRINT(_L("CWatchdog::ConstructL() - create observer"));
iShutdownObserver = CWDShutdownObserver::NewL( *this );
iSelfShutdownObserver = CWDSelfShutdownObserver::NewL( *this );
-
- RProcess process;
- process.SetPriority( EPriorityBackground );
- process.Close();
}
void CWatchdog::Start()
- {
-
+ {
PRINT(_L("CWatchdog::Start()"));
- // Create the server process
+ // Double check that harvester server is not already running
+ TFullName name;
TInt res( KErrNone );
+
+ // find Harvester Server
+ TFindProcess findProcess( KHarvesterServerProcess );
+ if ( findProcess.Next(name) == KErrNone )
+ {
+ PRINT(_L("CWatchdog::Start() - server already running, start listening"));
+
+ iProcess.Close();
+ res = iProcess.Open(name);
+ if ( res != KErrNone )
+ {
+ PRINT(_L("CWatchdog::Start() - error in starting listening "));
+ return;
+ }
+ iState = EWaitingRendezvous;
+ SetActive();
+ return;
+ }
+ // Create the server process
// KNullDesC param causes server's E32Main() to be run
res = iProcess.Create( KHarvesterServerExe, KNullDesC );
if ( res != KErrNone )
@@ -189,8 +204,7 @@
}
default:
- break;
-
+ break;
}