[SPIN] Check if network is already removed in connect callback. 11/74711/2
authorNiraj Kumar Goit <niraj.g@samsung.com>
Wed, 15 Jun 2016 14:56:19 +0000 (20:26 +0530)
committerNiraj Kumar Goit <niraj.g@samsung.com>
Fri, 17 Jun 2016 10:33:50 +0000 (03:33 -0700)
Change-Id: I6b7916473347bba2b93d1565d59c95eaca0d2190
Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
plugins/bluetooth.c

index 24f3aa5..f72a4af 100755 (executable)
@@ -217,6 +217,18 @@ static void pan_connect_cb(DBusMessage *message, void *user_data)
                return;
        }
 
+#ifdef TIZEN_EXT
+       /*
+        * Network could be removed because of BT adapter power off
+        * This is to handle the scenario where network is removed
+        * before the connect_cb is called
+        */
+       if (!pan->network) {
+               DBG("network already removed");
+               return;
+       }
+#endif
+
        if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_ERROR) {
                const char *dbus_error = dbus_message_get_error_name(message);
 
@@ -535,7 +547,10 @@ static void device_enable_cb(const DBusError *error, void *user_data)
                goto out;
        }
 
+#if !defined TIZEN_EXT
        enable_device(device, path);
+#endif
+
 out:
        g_free(path);
 }
@@ -602,7 +617,9 @@ static void device_disable_cb(const DBusError *error, void *user_data)
                goto out;
        }
 
+#if !defined TIZEN_EXT
        disable_device(device, path);
+#endif
 
 out:
        g_free(path);