From a535dbcccf034720562d9b593942d00f5f1bb1fd Mon Sep 17 00:00:00 2001 From: Sunwook Bae Date: Tue, 21 May 2013 13:42:06 +0900 Subject: [PATCH] Fix an issue on registering the same port Change-Id: I2f4f42ae30b9a4436d932478cbf73110f64fbf64 Signed-off-by: Sunwook Bae --- include/message-port.h | 6 ++++-- src/MessagePortProxy.cpp | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/message-port.h b/include/message-port.h index 677a50b..4c84da2 100755 --- a/include/message-port.h +++ b/include/message-port.h @@ -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 diff --git a/src/MessagePortProxy.cpp b/src/MessagePortProxy.cpp index eaf285f..8954eef 100644 --- a/src/MessagePortProxy.cpp +++ b/src/MessagePortProxy.cpp @@ -531,6 +531,7 @@ MessagePortProxy::IsLocalPortRegisted(const string& localPort, bool trusted, int } else { + _LOGD("MessagePort name is already registered."); for (map::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::iterator it = __ids.begin(); it != __trustedIds.end(); ++it) + _LOGD("MessagePort name is already registered."); + for (map::iterator it = __trustedIds.begin(); it != __trustedIds.end(); ++it) { if (localPort.compare(it->second) == 0) { -- 2.7.4