Fix an issue on registering the same port
authorSunwook Bae <sunwook45.bae@samsung.com>
Tue, 21 May 2013 04:42:06 +0000 (13:42 +0900)
committerSunwook Bae <sunwook45.bae@samsung.com>
Tue, 21 May 2013 04:42:06 +0000 (13:42 +0900)
Change-Id: I2f4f42ae30b9a4436d932478cbf73110f64fbf64
Signed-off-by: Sunwook Bae <sunwook45.bae@samsung.com>
include/message-port.h
src/MessagePortProxy.cpp

index 677a50b..4c84da2 100755 (executable)
@@ -55,7 +55,8 @@ typedef void (*messageport_message_cb)(int id, const char* remote_app_id, const
 
 
 /**
- * @brief Registers the local message port.
+ * @brief Registers the local message port. @n
+ * If the message port name is already registered, the previous message port id returns and the callback function is changed.
  *
  * @param [in] local_port the name of the local message port
  * @param [in] callback The callback function to be called when a message is received
@@ -69,7 +70,8 @@ int messageport_register_local_port(const char* local_port, messageport_message_
 
 /**
  * @brief Registers the trusted local message port. @n
- *  This allows communications only if the applications are signed with the same certificate which is uniquely assigned to the developer.
+ * If the message port name is already registered, the previous message port id returns and the callback function is changed. @n
+ * This allows communications only if the applications are signed with the same certificate which is uniquely assigned to the developer.
  *
  * @param [in] local_port the name of the local message port
  * @param [in] callback The callback function to be called when a message is received
index eaf285f..8954eef 100644 (file)
@@ -531,6 +531,7 @@ MessagePortProxy::IsLocalPortRegisted(const string& localPort, bool trusted, int
                }
                else
                {
+                       _LOGD("MessagePort name is already registered.");
                        for (map<int, string>::iterator it = __ids.begin(); it != __ids.end(); ++it)
                        {
                                if (localPort.compare(it->second) == 0)
@@ -550,7 +551,8 @@ MessagePortProxy::IsLocalPortRegisted(const string& localPort, bool trusted, int
                }
                else
                {
-                       for (map<int, string>::iterator it = __ids.begin(); it != __trustedIds.end(); ++it)
+                       _LOGD("MessagePort name is already registered.");
+                       for (map<int, string>::iterator it = __trustedIds.begin(); it != __trustedIds.end(); ++it)
                        {
                                if (localPort.compare(it->second) == 0)
                                {