Remove unused reconnect logic code 88/275088/2
authorSuyeon Hwang <stom.hwang@samsung.com>
Mon, 16 May 2022 11:41:05 +0000 (20:41 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Fri, 17 Jun 2022 02:57:49 +0000 (02:57 +0000)
- Issue:
By calling __reconnect() function from __on_disconnected() callback, unused memory is created.

- Solution:
When client loose the connection to service engine, client tries to reconnect to service engine by
calling tts_core_handle_service_reset() function. This function checks the service engine status
and tries again the prepare processing. So reconnection by __reconnect() function is not necessary.
And also, __reconnect() creates unused information structure memory. Of course these memories are
not searched because the order of append into list. However, this can make memory explosion, so
by this patch, I remove this unused function.

Change-Id: Ic0b0d2aefbb31d8235b4331e1f6f78fa1d4a10ca
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
client/tts_tidl.c

index 1ed6a3b2d29b10aead192ef54c09081e447cddaa..409eb52ac4602a1997302edea397f3e7f5ab4eb6 100644 (file)
@@ -58,28 +58,6 @@ static tts_tidl_info_s* __get_tidl_info_s(unsigned int uid)
        return NULL;
 }
 
-static void __reconnect(void *data)
-{
-       unsigned int uid = (uintptr_t)data;
-
-       tts_client_s *client = tts_client_get_by_uid(uid);
-       if (!client)
-               return;
-
-       for (int nsec = 1; nsec <= MAXSLEEP; nsec <<= 1) {
-               if (0 == tts_tidl_open_connection(uid)) {
-                       SLOG(LOG_DEBUG, TAG_TTSC, "Try to connect the service");
-                       return;
-               }
-
-               if (nsec <= MAXSLEEP/2)
-                       sleep(nsec);
-
-               SLOG(LOG_DEBUG, TAG_TTSC, "Retrying...");
-       }
-       return;
-}
-
 static void __notify_cb(void *user_data, int pid, int uid, bundle *msg)
 {
        char *method = NULL;
@@ -185,12 +163,11 @@ static void __on_disconnected(rpc_port_proxy_tts_h h, void *user_data)
        info->connected = false;
        info->connection_requesting = false;
        info->register_callback_invoked = false;
-       if (tts_client_is_listening_started(uid)) {
-               tts_core_handle_service_reset();
-               SLOG(LOG_DEBUG, TAG_TTSC, "Disconnected from server");
 
-               ecore_main_loop_thread_safe_call_async(__reconnect, user_data);
+       SLOG(LOG_DEBUG, TAG_TTSC, "Disconnected from server");
+       if (tts_client_is_listening_started(uid)) {
                SLOG(LOG_DEBUG, TAG_TTSC, "Try to reconnect to server");
+               tts_core_handle_service_reset();
        }
 }