sysstatemgmt/systemstatemgr/ssm/src/ssmswppolicycli.cpp
changeset 64 61992147389a
parent 0 4e1aa6a622a0
--- a/sysstatemgmt/systemstatemgr/ssm/src/ssmswppolicycli.cpp	Mon Aug 23 14:47:20 2010 +0300
+++ b/sysstatemgmt/systemstatemgr/ssm/src/ssmswppolicycli.cpp	Fri Sep 10 19:45:56 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -41,10 +41,17 @@
 		User::Leave(KErrAlreadyExists);
 		}
 
-	const TInt err = CreateSession(KSsmSwpPolicySrvName, iVersion, KSsmSwpPolicySrvMsgSlots);
+	TInt err = CreateSession(KSsmSwpPolicySrvName, iVersion, KSsmSwpPolicySrvMsgSlots);
 	if((KErrNotFound == err) || (KErrServerTerminated == err))
 		{
-		User::LeaveIfError(CSsmSwpPolicyServer::StartSsmSwpPolicySrv(KSsmSwpPolicySrvName));
+		err = CSsmSwpPolicyServer::StartSsmSwpPolicySrv(KSsmSwpPolicySrvName);
+
+		DEBUGPRINT2(_L("Starting SsmSwpPolicySrv completed with %d"),err);
+		if (KErrNone !=  err && KErrAlreadyExists != err)
+			{
+			User::Leave(err);
+			}
+
 		User::LeaveIfError(CreateSession(KSsmSwpPolicySrvName, iVersion, KSsmSwpPolicySrvMsgSlots));
 		DEBUGPRINT1(_L("RSsmSwpPolicySession Connect Completed with KErrNone"));
 		}
@@ -72,10 +79,17 @@
 		User::Leave(KErrAlreadyExists);
 		}
 
-	const TInt err = CreateSession(aServerName, iVersion, KSsmSwpPolicySrvMsgSlots);
+	TInt err = CreateSession(aServerName, iVersion, KSsmSwpPolicySrvMsgSlots);
 	if((KErrNotFound == err) || (KErrServerTerminated == err))
 		{
-		User::LeaveIfError(CSsmSwpPolicyServer::StartSsmSwpPolicySrv(aServerName));
+		err = CSsmSwpPolicyServer::StartSsmSwpPolicySrv(aServerName);
+
+		DEBUGPRINT2(_L("Starting SsmSwpPolicySrv completed with %d"),err);
+		if (KErrNone !=  err && KErrAlreadyExists != err)
+			{
+			User::Leave(err);
+			}
+		
 		User::LeaveIfError(CreateSession(aServerName, iVersion, KSsmSwpPolicySrvMsgSlots));
 		DEBUGPRINT1(_L("RSsmSwpPolicySession Connect Completed with KErrNone"));
 		}