Remove GetProperties call from profile CLOSE event 48/245048/3
authorNishant Chaprana <n.chaprana@samsung.com>
Tue, 29 Sep 2020 13:11:40 +0000 (18:41 +0530)
committerNishant Chaprana <n.chaprana@samsung.com>
Mon, 2 Nov 2020 11:20:34 +0000 (16:50 +0530)
Change-Id: Iad04e8292fe541604da0f407d28f1ae1d8e1143b
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
packaging/capi-network-wifi-manager.spec
src/network_signal.c
src/wifi_internal.c

index 558c226..a989c18 100755 (executable)
@@ -1,6 +1,6 @@
 Name:          capi-network-wifi-manager
 Summary:       Network Wi-Fi library in TIZEN C API
-Version:       1.2.6
+Version:       1.2.7
 Release:       1
 Group:         System/Network
 License:       Apache-2.0
index 0f326ed..8ce810c 100755 (executable)
@@ -593,7 +593,7 @@ static void __net_handle_state_ind(network_info_s *network_info,
 }
 
 static void __net_handle_failure_ind(network_info_s *network_info,
-               const char *profile_name)
+               net_profile_info_s *profile_info)
 {
        __NETWORK_FUNC_ENTER__;
 
@@ -604,20 +604,28 @@ static void __net_handle_failure_ind(network_info_s *network_info,
        const char *svc_name2 = request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].ProfileName;
        const char *svc_name3 = request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION].ProfileName;
 
+       if (profile_info == NULL) {
+               __NETWORK_FUNC_EXIT__;
+               return;
+       }
+
        event_data = g_try_malloc0(sizeof(net_event_info_s));
        if (event_data == NULL) {
                __NETWORK_FUNC_EXIT__;
                return;
        }
 
+       event_data->Datalength = sizeof(net_profile_info_s);
+       event_data->Data = profile_info;
+
        if (request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE &&
-                       strstr(profile_name, svc_name1) != NULL) {
+                       strstr(profile_info->ProfileName, svc_name1) != NULL) {
                memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION], 0,
                                sizeof(network_request_table_s));
 
                event_data->Event = NET_EVENT_OPEN_RSP;
        } else if (request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].flag == TRUE &&
-                       g_strcmp0(profile_name, svc_name2) == 0) {
+                       g_strcmp0(profile_info->ProfileName, svc_name2) == 0) {
                memset(&request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS], 0,
                                sizeof(network_request_table_s));
 
@@ -626,20 +634,20 @@ static void __net_handle_failure_ind(network_info_s *network_info,
                memset(&request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION], 0,
                                                sizeof(network_request_table_s));
        } else if (request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION].flag == TRUE &&
-                       g_strcmp0(profile_name, svc_name3) == 0) {
+                       g_strcmp0(profile_info->ProfileName, svc_name3) == 0) {
                memset(&request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION], 0,
                                sizeof(network_request_table_s));
 
                event_data->Event = NET_EVENT_CLOSE_RSP;
        } else {
-               __net_handle_state_ind(network_info, profile_name, NET_STATE_TYPE_FAILURE);
+               __net_handle_state_ind(network_info, profile_info->ProfileName, NET_STATE_TYPE_FAILURE);
                g_free(event_data);
                __NETWORK_FUNC_EXIT__;
                return;
        }
 
        g_strlcpy(event_data->ProfileName,
-                       profile_name, NET_PROFILE_NAME_LEN_MAX + 1);
+                       profile_info->ProfileName, NET_PROFILE_NAME_LEN_MAX + 1);
 
        if (network_info->net_service_error != NET_ERR_NONE)
                event_data->Error = network_info->net_service_error;
@@ -647,8 +655,6 @@ static void __net_handle_failure_ind(network_info_s *network_info,
                event_data->Error = NET_ERR_CONNECTION_CONNECT_FAILED;
                WIFI_LOG(WIFI_ERROR, "Event error defined %d", event_data->Error);
        }
-       event_data->Datalength = 0;
-       event_data->Data = NULL;
 
        network_info->net_service_error = NET_ERR_NONE;
 
@@ -665,7 +671,7 @@ static void __net_handle_failure_ind(network_info_s *network_info,
 }
 
 static void __net_handle_disconnect_ind(network_info_s *network_info,
-               const char *profile_name)
+               net_profile_info_s *profile_info)
 {
        __NETWORK_FUNC_ENTER__;
 
@@ -675,21 +681,29 @@ static void __net_handle_disconnect_ind(network_info_s *network_info,
        const char *svc_name2 = request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].ProfileName;
        const char *svc_name3 = request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].ProfileName;
 
+       if (profile_info == NULL) {
+               __NETWORK_FUNC_EXIT__;
+               return;
+       }
+
        event_data = g_try_malloc0(sizeof(net_event_info_s));
        if (event_data == NULL) {
                __NETWORK_FUNC_EXIT__;
                return;
        }
 
+       event_data->Datalength = sizeof(net_profile_info_s);
+       event_data->Data = profile_info;
+
        if (request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE &&
-                       strstr(profile_name, svc_name2) != NULL) {
+                       strstr(profile_info->ProfileName, svc_name2) != NULL) {
                memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION], 0,
                                sizeof(network_request_table_s));
 
                /** Send Open Resp */
                event_data->Error = NET_ERR_OPERATION_ABORTED;
                event_data->Event =  NET_EVENT_OPEN_RSP;
-               g_strlcpy(event_data->ProfileName, profile_name, NET_PROFILE_NAME_LEN_MAX + 1);
+               g_strlcpy(event_data->ProfileName, profile_info->ProfileName, NET_PROFILE_NAME_LEN_MAX + 1);
 
                WIFI_LOG(WIFI_INFO, "Sending NET_EVENT_OPEN_RSP");
 
@@ -702,14 +716,14 @@ static void __net_handle_disconnect_ind(network_info_s *network_info,
        }
 
        if (request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].flag == TRUE &&
-                       g_strcmp0(profile_name, svc_name3) == 0) {
+                       g_strcmp0(profile_info->ProfileName, svc_name3) == 0) {
                memset(&request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS], 0,
                                sizeof(network_request_table_s));
 
                /** Send WPS Resp */
                event_data->Error = NET_ERR_OPERATION_ABORTED;
                event_data->Event =  NET_EVENT_WIFI_WPS_RSP;
-               g_strlcpy(event_data->ProfileName, profile_name, NET_PROFILE_NAME_LEN_MAX + 1);
+               g_strlcpy(event_data->ProfileName, profile_info->ProfileName, NET_PROFILE_NAME_LEN_MAX + 1);
 
                WIFI_LOG(WIFI_INFO, "Sending NET_EVENT_WIFI_WPS_RSP");
 
@@ -722,14 +736,14 @@ static void __net_handle_disconnect_ind(network_info_s *network_info,
        }
 
        if (request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION].flag == TRUE &&
-                       g_strcmp0(profile_name, svc_name1) == 0) {
+                       g_strcmp0(profile_info->ProfileName, svc_name1) == 0) {
                memset(&request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION], 0,
                                sizeof(network_request_table_s));
 
                /** Send Close Resp */
                event_data->Error = NET_ERR_NONE;
                event_data->Event =  NET_EVENT_CLOSE_RSP;
-               g_strlcpy(event_data->ProfileName, profile_name, NET_PROFILE_NAME_LEN_MAX + 1);
+               g_strlcpy(event_data->ProfileName, profile_info->ProfileName, NET_PROFILE_NAME_LEN_MAX + 1);
 
                WIFI_LOG(WIFI_INFO, "Sending NET_EVENT_CLOSE_RSP");
 
@@ -744,7 +758,7 @@ static void __net_handle_disconnect_ind(network_info_s *network_info,
        /** Send Close Ind */
        event_data->Error = NET_ERR_NONE;
        event_data->Event =  NET_EVENT_CLOSE_IND;
-       g_strlcpy(event_data->ProfileName, profile_name, NET_PROFILE_NAME_LEN_MAX + 1);
+       g_strlcpy(event_data->ProfileName, profile_info->ProfileName, NET_PROFILE_NAME_LEN_MAX + 1);
 
        WIFI_LOG(WIFI_INFO, "Sending NET_EVENT_CLOSE_IND");
 
@@ -794,7 +808,7 @@ static int __net_handle_service_state_changed(network_info_s *network_info,
                if (old_state == NET_STATE_TYPE_DISCONNECT) {
                        break;
                } else if (old_state != NET_STATE_TYPE_FAILURE) {
-                       __net_handle_disconnect_ind(network_info, sig_path);
+                       __net_handle_disconnect_ind(network_info, prof_info);
                        break;
                }
 
@@ -860,11 +874,11 @@ static int __net_handle_service_state_changed(network_info_s *network_info,
        }
        case NET_STATE_TYPE_DISCONNECT:
        {
-               __net_handle_disconnect_ind(network_info, sig_path);
+               __net_handle_disconnect_ind(network_info, prof_info);
                break;
        }
        case NET_STATE_TYPE_FAILURE:
-               __net_handle_failure_ind(network_info, sig_path);
+               __net_handle_failure_ind(network_info, prof_info);
                break;
 
        default:
index 076de25..025df19 100755 (executable)
@@ -1295,24 +1295,11 @@ static void _wifi_evt_cb(net_event_info_s *event_cb, void *user_data)
 
                switch (event_cb->Error) {
                case NET_ERR_NONE:
-                       if (net_get_profile_info(wifi_handle->network_info,
-                                       event_cb->ProfileName, &prof_info) == NET_ERR_NONE) {
-                               __state_changed_cb(wifi_handle, event_cb->ProfileName, &prof_info,
-                                               WIFI_MANAGER_CONNECTION_STATE_DISCONNECTED);
-
-                               /* Free internal GSList */
-                               if (prof_info.vsie_list) {
-                                       g_slist_free_full(prof_info.vsie_list, g_free);
-                                       prof_info.vsie_list = NULL;
-                               }
+                       if (event_cb->Datalength == sizeof(net_profile_info_s))
+                               prof_info_p = (net_profile_info_s *)event_cb->Data;
 
-                               if (prof_info.bssid_list) {
-                                       g_slist_free_full(prof_info.bssid_list, g_free);
-                                       prof_info.bssid_list = NULL;
-                               }
-                       } else
-                               __state_changed_cb(wifi_handle, event_cb->ProfileName, NULL,
-                                               WIFI_MANAGER_CONNECTION_STATE_DISCONNECTED);
+                       __state_changed_cb(wifi_handle, event_cb->ProfileName, prof_info_p,
+                                                       WIFI_MANAGER_CONNECTION_STATE_DISCONNECTED);
 
                        WIFI_LOG(WIFI_INFO, "Connection close succeeded!");
                        /* Checking if disconnection request was sent when WPS PBC connection