428 } |
428 } |
429 |
429 |
430 TPtr moduleName = cmdLine->Des(); |
430 TPtr moduleName = cmdLine->Des(); |
431 User().CommandLine( moduleName ); |
431 User().CommandLine( moduleName ); |
432 |
432 |
433 RDebug::Print (moduleName); |
433 RDebug::Print(_L("StartSession() Received data [%S]"), &moduleName); |
|
434 |
|
435 // Extract semaphore name passed in data |
|
436 TInt index = moduleName.Find(_L(" ")); |
|
437 RDebug::Print(_L("StartSession() Space separator found at position [%d]"), index); |
|
438 TPtrC semaphoreName = moduleName.Mid(index + 1); |
|
439 moduleName = moduleName.Left(index); |
|
440 |
|
441 RDebug::Print(_L("StartSession() Extracted module name [%S] and sempahore name [%S]"), &moduleName, &semaphoreName); |
434 |
442 |
435 // Open start-up synchronization semaphore |
443 // Open start-up synchronization semaphore |
436 RSemaphore startup; |
444 RSemaphore startup; |
437 RDebug::Print(_L(" Openingstart-up semaphore")); |
445 RDebug::Print(_L(" Opening start-up semaphore")); |
438 TName semaphoreName = _L("startupSemaphore"); |
446 // TName semaphoreName = _L("startupSemaphore"); |
439 semaphoreName.Append( moduleName ); |
447 // semaphoreName.Append( moduleName ); |
440 |
448 |
441 TInt res = startup.OpenGlobal(semaphoreName); |
449 TInt res = startup.OpenGlobal(semaphoreName); |
442 RDebug::Print(_L("Opening result %d"), res); |
450 RDebug::Print(_L("Opening result %d"), res); |
443 |
451 |
444 |
452 |
446 TInt r = StartNewServer ( moduleName, serverName, EFalse, startup); |
454 TInt r = StartNewServer ( moduleName, serverName, EFalse, startup); |
447 |
455 |
448 if ( r == KErrAlreadyExists ) |
456 if ( r == KErrAlreadyExists ) |
449 { |
457 { |
450 // Ok, server was already started |
458 // Ok, server was already started |
451 RDebug::Print(_L("Server already started, signaling semaphore and existing")); |
459 RDebug::Print(_L("Server already started, signaling semaphore and exiting")); |
452 startup.Signal(); |
460 startup.Signal(); |
453 //__UHEAP_MARKEND; |
461 //__UHEAP_MARKEND; |
454 |
462 |
455 delete cmdLine; |
463 delete cmdLine; |
456 |
464 |