RemoteMessagePort::SendMessage() returns E_SYSTEM when the socket receiver buffer...
[platform/framework/native/appfw.git] / src / io / FIo_MessagePortProxy.cpp
index d2e32fb..1252927 100644 (file)
@@ -1,5 +1,4 @@
 //
-// Open Service Platform
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the License);
 #include <typeinfo>
 #include <unique_ptr.h>
 
-#include <package_manager.h>
-
 #include <message-port.h>
 
 #include <FBaseSysLog.h>
+#include <FBaseByteBuffer.h>
+
 #include <FBase_StringConverter.h>
 #include <FApp_AppInfo.h>
 
@@ -46,7 +45,7 @@ using namespace Tizen::Base::Runtime;
 namespace Tizen { namespace Io
 {
 
-static const int MAX_MESSAGE_SIZE = 16 * 1024;
+//static const int MAX_MESSAGE_SIZE = 16 * 1024;
 
 static void
 ConvertBundleToMap(const char *pKey, const int type, const bundle_keyval_t *pVal, void *pData)
@@ -232,7 +231,6 @@ _MessagePortProxy::RegisterMessagePort(const String& localPort,     bool isTrusted,
 {
        SysSecureLog(NID_IO, "Register a message port : [%ls:%ls]", __appId.GetPointer(), localPort.GetPointer());
 
-       result r = E_SUCCESS;
        int ret = 0;
        bool contain = false;
 
@@ -348,6 +346,11 @@ _MessagePortProxy::SendMessage(const AppId& remoteAppId, const String& remotePor
 
        if (ret < 0)
        {
+               if (ret == MESSAGEPORT_ERROR_RESOURCE_UNAVAILABLE)
+               {
+                       SysLogException(NID_IO, E_SYSTEM, "[E_SYSTEM] The socket receiver queue of remote port is temporarily full.");
+               }
+
                result r = ConvertToResult(ret);
 
                SysTryReturnResult(NID_IO, r != E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "The remote message port is not found.");
@@ -405,6 +408,11 @@ _MessagePortProxy::SendMessage(const String& localPort, bool isTrustedLocal, con
 
        if (ret < 0)
        {
+               if (ret == MESSAGEPORT_ERROR_RESOURCE_UNAVAILABLE)
+               {
+                       SysLogException(NID_IO, E_SYSTEM, "[E_SYSTEM] The socket receiver queue of remote port is temporarily full.");
+               }
+
                result r = ConvertToResult(ret);
 
                SysTryReturnResult(NID_IO, r != E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "The remote message port is not found.");
@@ -464,6 +472,9 @@ _MessagePortProxy::ConvertToResult(int error)
                case MESSAGEPORT_ERROR_MAX_EXCEEDED:
                        return E_MAX_EXCEEDED;
 
+               case MESSAGEPORT_ERROR_RESOURCE_UNAVAILABLE:
+                       // fall through
+
                default:
                        return E_SYSTEM;
        }