From: Hwankyu Jhun Date: Thu, 2 Feb 2023 02:37:06 +0000 (+0000) Subject: Move port existence check to the Watch method X-Git-Tag: accepted/tizen/7.0/unified/20230327.042705~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df48af98ddff8a04ee63991edeb07ef6ec4efc8e;p=platform%2Fcore%2Fappfw%2Frpc-port.git Move port existence check to the Watch method To make unblocking the main thread, the port existence check is moved to the Watch() method. If the proxy application calls the rpc_port_proxy_connect() function in the sub thread, the Aul::ExistPort() is called in the thread. Change-Id: Ie82e0527c56981337c1b241c8d2b090696a1b0de Signed-off-by: Hwankyu Jhun --- diff --git a/src/proxy-internal.cc b/src/proxy-internal.cc index 518c436..804f690 100644 --- a/src/proxy-internal.cc +++ b/src/proxy-internal.cc @@ -297,6 +297,9 @@ int Proxy::Watch() { return -1; } + port_exist_ = Aul::ExistPort(real_appid_, port_name_, + rpc_port_get_target_uid()); + SetConnTimer(); SetIdler(); return 0; @@ -475,9 +478,7 @@ gboolean Proxy::OnIdle(gpointer user_data) { DestroyWeakPtr(proxy->idler_data_); proxy->idler_data_ = nullptr; - bool exist = Aul::ExistPort(proxy->real_appid_, proxy->port_name_, - rpc_port_get_target_uid()); - if (exist) { + if (proxy->port_exist_) { proxy->OnPortAppeared(proxy->real_appid_.c_str(), proxy->port_name_.c_str(), -1, proxy.get()); } else { diff --git a/src/proxy-internal.hh b/src/proxy-internal.hh index 5003539..c22aafc 100644 --- a/src/proxy-internal.hh +++ b/src/proxy-internal.hh @@ -145,6 +145,7 @@ class Proxy : public std::enable_shared_from_this { gpointer conn_timer_data_ = nullptr; gpointer idler_data_ = nullptr; mutable std::recursive_mutex mutex_; + bool port_exist_ = false; }; } // namespace internal