From 0e80969be14864aa73d5f21552bd6032b3e22009 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 2 Sep 2020 12:23:15 +0900 Subject: [PATCH] Fix rpc_port_proxy_destroy() function rpc_port_proxy_destroy() calls DisconnectPort() method to disconnect main port. Change-Id: Ia86611a4a6442805f94af335a699a105ad285f5e Signed-off-by: Hwankyu Jhun --- src/proxy-internal.cc | 6 ++++-- src/proxy-internal.h | 1 + src/rpc-port.cc | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/proxy-internal.cc b/src/proxy-internal.cc index 217e974..9adfe88 100644 --- a/src/proxy-internal.cc +++ b/src/proxy-internal.cc @@ -201,7 +201,6 @@ int Proxy::Connect(std::string appid, std::string port_name, return RPC_PORT_ERROR_NONE; } -// LCOV_EXCL_START int Proxy::ConnectSync(std::string appid, std::string port_name, IEventListener* ev) { if (ev == nullptr) @@ -244,7 +243,10 @@ int Proxy::ConnectSync(std::string appid, std::string port_name, return RPC_PORT_ERROR_NONE; } -// LCOV_EXCL_STOP + +void Proxy::DisconnectPort() { + main_port_.reset(); +} void Proxy::SetRealAppId(const std::string& alias_appid) { if (!real_appid_.empty()) diff --git a/src/proxy-internal.h b/src/proxy-internal.h index 389ad29..5ada809 100644 --- a/src/proxy-internal.h +++ b/src/proxy-internal.h @@ -45,6 +45,7 @@ class Proxy : public FdBroker::IEventWatcher { int Connect(std::string appid, std::string port_name, IEventListener* ev); int ConnectSync(std::string appid, std::string port_name, IEventListener* ev); + void DisconnectPort(); std::shared_ptr GetPort() const { return main_port_; diff --git a/src/rpc-port.cc b/src/rpc-port.cc index e88f699..81362f6 100644 --- a/src/rpc-port.cc +++ b/src/rpc-port.cc @@ -262,7 +262,9 @@ RPC_API int rpc_port_proxy_destroy(rpc_port_proxy_h h) { return RPC_PORT_ERROR_INVALID_PARAMETER; auto p = static_cast<::ProxyExt*>(h); + _W("rpc_port_proxy_destroy(%p)", p); p->SetDestroying(true); + p->DisconnectPort(); g_idle_add_full(G_PRIORITY_HIGH, [](gpointer data) -> gboolean { -- 2.7.4