Send Error code only to requesting application. 37/148737/3
authorNiraj Kumar Goit <niraj.g@samsung.com>
Fri, 8 Sep 2017 13:27:21 +0000 (18:57 +0530)
committerNiraj Kumar Goit <niraj.g@samsung.com>
Mon, 11 Sep 2017 03:40:55 +0000 (09:10 +0530)
Description: If an application request for wifi scan
and it gets failed, then send error code only to the
requesting application.

Change-Id: I90bc3b0af68e9d3ff5c2e4709f5788c1f107a854
Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
src/technology.c

index 94b99ea..a8da19b 100755 (executable)
@@ -1179,18 +1179,27 @@ static DBusMessage *scan(DBusConnection *conn, DBusMessage *msg, void *data)
                        dbus_message_get_sender(msg));
 
        dbus_message_ref(msg);
+#if !defined TIZEN_EXT
        technology->scan_pending =
                g_slist_prepend(technology->scan_pending, msg);
+#endif
 
        err = __connman_device_request_scan(technology->type);
+#if defined TIZEN_EXT
+       if (err < 0)
+               return __connman_error_failed(msg, -err);
+#else
        if (err < 0)
                reply_scan_pending(technology, err);
+#endif
 
 #if defined TIZEN_EXT
        if (err == 0) {
                g_scan_type = CONNMAN_SCAN_TYPE_FULL_CHANNEL;
                DBG("g_scan_type %d", g_scan_type);
        }
+       technology->scan_pending =
+               g_slist_prepend(technology->scan_pending, msg);
 #endif
        return NULL;
 }
@@ -1256,12 +1265,10 @@ static DBusMessage *specific_scan(DBusConnection *conn, DBusMessage *msg, void *
        }
 
        dbus_message_ref(msg);
-       technology->scan_pending =
-               g_slist_prepend(technology->scan_pending, msg);
 
        err = __connman_device_request_specific_scan(technology->type, scan_type, specific_scan_list);
        if (err < 0)
-               reply_scan_pending(technology, err);
+               return __connman_error_failed(msg, -err);
 
        if (err == 0) {
                guint list_size = g_slist_length(specific_scan_list);
@@ -1271,6 +1278,8 @@ static DBusMessage *specific_scan(DBusConnection *conn, DBusMessage *msg, void *
                        g_scan_type = CONNMAN_SCAN_TYPE_MULTI_AP;
                DBG("list_size %u g_scan_type %d", list_size, g_scan_type);
        }
+       technology->scan_pending =
+               g_slist_prepend(technology->scan_pending, msg);
 
        if (scan_type == 1) {
                g_slist_free_full(specific_scan_list, g_free);