Clear all callback timers when deinit 02/288302/1 accepted/tizen/7.0/unified/20230216.140342 accepted/tizen/unified/20230315.093506
authorJaehyun Kim <jeik01.kim@samsung.com>
Wed, 15 Feb 2023 03:02:58 +0000 (12:02 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Wed, 15 Feb 2023 03:02:58 +0000 (12:02 +0900)
Change-Id: I4bbd9d2e34378842ff5039552ac9795e5ba2f62a
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
src/network_interface.c

index af602dd..28ee41b 100644 (file)
@@ -1277,6 +1277,34 @@ static int __net_extract_connected_profile(network_info_s *network_info,
        return err;
 }
 
+static void _net_clear_cb_timers(void)
+{
+       if (connection_cb_timer > 0) {
+               g_source_remove(connection_cb_timer);
+               connection_cb_timer = 0;
+       }
+
+       if (full_scan_cb_timer > 0) {
+               g_source_remove(full_scan_cb_timer);
+               full_scan_cb_timer = 0;
+       }
+
+       if (specific_scan_cb_timer > 0) {
+               g_source_remove(specific_scan_cb_timer);
+               specific_scan_cb_timer = 0;
+       }
+
+       if (multi_scan_cb_timer > 0) {
+               g_source_remove(multi_scan_cb_timer);
+               multi_scan_cb_timer = 0;
+       }
+
+       if (bssid_scan_cb_timer > 0) {
+               g_source_remove(bssid_scan_cb_timer);
+               bssid_scan_cb_timer = 0;
+       }
+}
+
 void net_forget_ap_finished(network_info_s *network_info, net_err_e Error)
 {
        __NETWORK_FUNC_ENTER__;
@@ -2202,27 +2230,7 @@ int net_wifi_power_off(network_info_s *network_info)
                return NET_ERR_IN_PROGRESS; //LCOV_EXCL_LINE
        }
 
-       if (connection_cb_timer > 0) {
-               g_source_remove(connection_cb_timer);
-               connection_cb_timer = 0;
-       }
-
-       if (full_scan_cb_timer > 0) {
-               g_source_remove(full_scan_cb_timer);
-               full_scan_cb_timer = 0;
-       }
-       if (specific_scan_cb_timer > 0) {
-               g_source_remove(specific_scan_cb_timer);
-               specific_scan_cb_timer = 0;
-       }
-       if (multi_scan_cb_timer > 0) {
-               g_source_remove(multi_scan_cb_timer);
-               multi_scan_cb_timer = 0;
-       }
-       if (bssid_scan_cb_timer > 0) {
-               g_source_remove(bssid_scan_cb_timer);
-               bssid_scan_cb_timer = 0;
-       }
+       _net_clear_cb_timers();
 
        if (network_info->request_table[NETWORK_REQUEST_TYPE_SCAN].flag == TRUE)
                memset(&(network_info->request_table[NETWORK_REQUEST_TYPE_SCAN]),
@@ -2944,6 +2952,7 @@ void net_deregister_client_ext(network_info_s *network_info)
                network_info->user_data = NULL;
                network_info->wifi_handle = NULL;
 
+               _net_clear_cb_timers();
                _net_deregister_signal(network_info);
                _net_dbus_close_gdbus_call(network_info);
                _net_clear_request_table(network_info);