locationsystemui/locationsysui/posindicator/posindhelperclientlib/src/posindicatorhelperserver.cpp
changeset 50 4c28d569e1fe
parent 33 834e27cad510
--- a/locationsystemui/locationsysui/posindicator/posindhelperclientlib/src/posindicatorhelperserver.cpp	Mon Aug 23 17:49:43 2010 +0530
+++ b/locationsystemui/locationsysui/posindicator/posindhelperclientlib/src/posindicatorhelperserver.cpp	Mon Sep 27 16:57:22 2010 +0530
@@ -50,45 +50,16 @@
 	
 	if( ret == KErrNotFound )
 	    {
-#if defined(__WINSCW__)
-	    StartLbsRootProcess();
-#endif
-	    RProcess posIndHelperServerProcess;
-	    ret = posIndHelperServerProcess.Create(KPosIndHelperSrvName, KNullDesC);
-	    
-	    if( ret != KErrNone )
-	        {
-	        posIndHelperServerProcess.Close();
-	        return KErrNotFound;
-	        }
-	    
-	    TRequestStatus status;
-	    posIndHelperServerProcess.Rendezvous(status);
-	    
-	    if( status != KRequestPending )
+	    ret = StartServer();
+	    if( !( ret == KErrNone || ret == KErrAlreadyExists ) )
 	        {
-	        User::WaitForRequest(status);
-	        posIndHelperServerProcess.Kill(KErrNone);
-	        posIndHelperServerProcess.Close();
-	        return status.Int();
-	        }
-	    else
-	        {
-	        posIndHelperServerProcess.Resume();		        
-	        }
-
-	    User::WaitForRequest(status);
-	    posIndHelperServerProcess.Close();
-
-	    if( status != KErrNone )
-	        {
-	        return (status.Int());
+	        return ret;
 	        }
 	    ret = CreateSession(KPosIndHelperSrvName, Version(), KDefaultMessageSlots);		    
 	    }
    
 	return ret;
-  }
+   }
 	
 // ---------------------------------------------------------
 // RPosIndicatorHelperServer::Close
@@ -117,6 +88,51 @@
 					KBuildVersionNumber);
 	}
 
+// ---------------------------------------------------------
+// RPosIndicatorHelperServer::StartServer
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt RPosIndicatorHelperServer::StartServer()
+    {
+    FUNC("+ RPosIndicatorHelperServer::StartServer");
+
+#if defined(__WINSCW__)
+    StartLbsRootProcess();
+#endif
+
+    RProcess posIndHelperServerProcess;
+    TInt ret = posIndHelperServerProcess.Create(KPosIndHelperSrvName, KNullDesC);
+    
+    if( ret != KErrNone )
+        {
+        posIndHelperServerProcess.Close();
+        return ret;
+        }
+    
+    TRequestStatus status;
+    posIndHelperServerProcess.Rendezvous(status);
+    
+    if( status != KRequestPending )
+        {
+        User::WaitForRequest(status);
+        posIndHelperServerProcess.Kill(KErrNone);
+        posIndHelperServerProcess.Close();
+        return status.Int();
+        }
+    else
+        {
+        posIndHelperServerProcess.Resume();             
+        }
+
+    User::WaitForRequest(status);
+    posIndHelperServerProcess.Close();
+   
+    FUNC("- RPosIndicatorHelperServer::StartServer");
+    return status.Int();
+    }
+ 
 #if defined(__WINSCW__)
 // ---------------------------------------------------------
 // RPosIndicatorHelperServer::Version