Add to disconnect rpc socket when client is finalized 77/281677/1
authorwn.jang <wn.jang@samsung.com>
Tue, 20 Sep 2022 11:46:23 +0000 (20:46 +0900)
committerTizen AI <ai.tzn.sec@samsung.com>
Tue, 20 Sep 2022 11:57:07 +0000 (20:57 +0900)
Cause: __on_disconnection is called when engine is terminated due to no more clients.

Change-Id: If3cfaa9c35ce8477e3c08e7d12c211d49e622c42
Solution: To avoid reconnect by service reset, disconnect rpc socket when client is finalized.

client/vc_mgr_tidl.c
client/vc_tidl.c
client/vc_widget_tidl.c

index 94f3bd9..9757e1e 100644 (file)
@@ -803,7 +803,18 @@ int vc_mgr_tidl_request_finalize(int pid)
        }
 
        if (VC_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager finalize : Fail to invoke message, error(%d)", ret);
+               SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager finalize : Fail to invoke finalize, error(%d)", ret);
+               return ret;
+       }
+
+       ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_disconnect(g_proxy_tidl_info->rpc_h);
+       exception = get_last_result();
+       if (RPC_PORT_ERROR_NONE != exception) {
+               ret = __convert_unhandled_error(exception);
+       }
+
+       if (VC_ERROR_NONE != ret) {
+               SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager finalize : Fail to disconnect, error(%d)", ret);
                return ret;
        }
 
index 205ee2f..c92aa53 100644 (file)
@@ -457,7 +457,18 @@ int vc_tidl_request_finalize(int pid)
        }
 
        if (VC_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc finalize : Fail to invoke message. err(%d)", ret);
+               SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc finalize : Fail to invoke finalize. err(%d)", ret);
+               return ret;
+       }
+
+       ret = rpc_port_proxy_vc_proxy_vc_disconnect(info->rpc_h);
+       exception = get_last_result();
+       if (RPC_PORT_ERROR_NONE != exception) {
+               ret = __convert_unhandled_error(exception);
+       }
+
+       if (VC_ERROR_NONE != ret) {
+               SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc finalize : Fail to disconnect. err(%d)", ret);
                return ret;
        }
 
index 2c7e705..9b6a80b 100644 (file)
@@ -501,7 +501,19 @@ int vc_widget_tidl_request_finalize(int pid)
        }
 
        if (VC_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget finalize : Fail to invoke message, error(%d)", ret);
+               SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget finalize : Fail to invoke finalize, error(%d)", ret);
+               pthread_mutex_unlock(&g_w_init_mutex);
+               return ret;
+       }
+
+       ret = rpc_port_proxy_vc_widget_proxy_vc_widget_disconnect(g_proxy_tidl_info->rpc_h);
+       exception = get_last_result();
+       if (RPC_PORT_ERROR_NONE != exception) {
+               ret = __convert_unhandled_error(exception);
+       }
+
+       if (VC_ERROR_NONE != ret) {
+               SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget finalize : Fail to disconnect, error(%d)", ret);
                pthread_mutex_unlock(&g_w_init_mutex);
                return ret;
        }