Fixed some invalid exception handling in asynchronous API for forgetting access point. 10/184810/1 submit/tizen/20180723.101631
authorJaehyun Kim <jeik01.kim@samsung.com>
Mon, 23 Jul 2018 08:39:55 +0000 (17:39 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Mon, 23 Jul 2018 08:58:19 +0000 (17:58 +0900)
Change-Id: I9638532b0964d45ad05c0e8e8d46362d0440de2e
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
src/network_interface.c

index d86e5c9..4e15cb6 100755 (executable)
@@ -1352,8 +1352,6 @@ void net_forget_ap_finshed(net_err_e Error)
        event_data.Event = NET_EVENT_WIFI_FORGET_AP_IND;
        g_strlcpy(event_string, "Sending NET_EVENT_WIFI_FORGET_AP_IND", 64);
 
-       _net_dbus_pending_call_unref();
-
        event_data.Error = Error;
        event_data.Datalength = 0;
        event_data.Data = NULL;
@@ -3092,18 +3090,14 @@ static void _net_delete_profile_async_reply(GObject *source_object,
                WIFI_LOG(WIFI_ERROR, "Delete profile, error [%s]\n", error->message);
                Error = NET_ERR_UNKNOWN;
                g_error_free(error);
-               _net_dbus_pending_call_unref();
-               __NETWORK_FUNC_EXIT__;
-               return;
+               goto error;
        }
 
        Error = NET_ERR_NO_PROFILE;
        g_variant_get(message, "(a(oa{sv}))", &iter);
        if (iter == NULL) {
                g_variant_unref(message);
-               _net_dbus_pending_call_unref();
-               __NETWORK_FUNC_EXIT__;
-               return;
+               goto error;
        }
 
        while (g_variant_iter_loop(iter, "(oa{sv})", &path, &service)) {
@@ -3119,6 +3113,9 @@ static void _net_delete_profile_async_reply(GObject *source_object,
        g_variant_iter_free(iter);
        g_variant_unref(message);
 
+       if (Error != NET_ERR_NONE)
+               goto error;
+
        g_strlcpy(wifi_prof_name.ProfileName,
                  request_table[NETWORK_REQUEST_TYPE_FORGET_AP].ProfileName,
                  NET_PROFILE_NAME_LEN_MAX + 1);
@@ -3130,16 +3127,22 @@ static void _net_delete_profile_async_reply(GObject *source_object,
                WIFI_LOG(WIFI_ERROR, //LCOV_EXCL_LINE
                                "Failed to delete service(profile). Error [%s]",
                                _net_print_error(Error));
-
-               Error = NET_ERR_UNKNOWN; //LCOV_EXCL_LINE
-               __NETWORK_FUNC_EXIT__; //LCOV_EXCL_LINE
+               goto error;
        }
 
-
        if (prof_info.ProfileState != NET_STATE_TYPE_ONLINE &&
-           prof_info.ProfileState != NET_STATE_TYPE_READY)
+           prof_info.ProfileState != NET_STATE_TYPE_READY &&
+           prof_info.ProfileState != NET_STATE_TYPE_ASSOCIATION &&
+           prof_info.ProfileState != NET_STATE_TYPE_CONFIGURATION)
                net_forget_ap_finshed(Error);
 
+       _net_dbus_pending_call_unref();
+       __NETWORK_FUNC_EXIT__;
+       return;
+
+error:
+       net_forget_ap_finshed(Error);
+       _net_dbus_pending_call_unref();
        __NETWORK_FUNC_EXIT__;
 }