Add a retry logic in IPC
[platform/framework/native/appfw.git] / src / server / io / FIo_IpcServer.cpp
index d0453c0..62b8476 100644 (file)
@@ -277,8 +277,7 @@ struct HelloMessage
 {
        int pid;
        bool reverse;  // true if the connection is for reverse message
-       char pkgId[256];
-       char appExecutableName[256];
+       char appId[256];
 };
 
 gboolean
@@ -306,8 +305,7 @@ _IpcServer::OnConnectionRequest(GIOChannel* source, GIOCondition condition, gpoi
        SysTryCatch(NID_IO, client != -1, , E_SYSTEM, "[E_SYSTEM] Accept failed.");
 
        read(client, &helloMessage, sizeof(helloMessage));
-       helloMessage.pkgId[255] = '\0';
-       helloMessage.appExecutableName[255] = '\0';
+       helloMessage.appId[255] = '\0';
 
        pChannel = g_io_channel_unix_new(client);
        SysTryCatch(NID_IO, pChannel != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Not enough memory.");
@@ -326,8 +324,7 @@ _IpcServer::OnConnectionRequest(GIOChannel* source, GIOCondition condition, gpoi
 
                pClientInfo->pIpcServer = pIpcServer;
                pClientInfo->clientId = helloMessage.pid;
-               pClientInfo->pkgId.Append((wchar_t*) helloMessage.pkgId);
-               pClientInfo->appExecutableName.Append((wchar_t*) helloMessage.appExecutableName);
+               pClientInfo->appId.Append((wchar_t*) helloMessage.appId);
                pClientInfo->pReverseChannel = null;
 
                pIpcServer->__clients[helloMessage.pid] = pClientInfo;
@@ -391,7 +388,10 @@ _IpcServer::GetClientPackageId(void) const
 
        if (__pCurrentClientInfo)
        {
-               return __pCurrentClientInfo->pkgId;
+               String pkgId;
+               __pCurrentClientInfo->appId.SubString(0, 10, pkgId);
+
+               return pkgId;
        }
 
        return nullString;
@@ -404,11 +404,7 @@ _IpcServer::GetClientApplicationId(void) const
 
        if (__pCurrentClientInfo)
        {
-               String appId(__pCurrentClientInfo->pkgId);
-               appId.Append(L'.');
-               appId.Append(__pCurrentClientInfo->appExecutableName);
-
-               return appId;
+               return __pCurrentClientInfo->appId;
        }
 
        return nullString;