OSDN Git Service

core: Fix incorrectly restarting service discovery after pairing
authorJohan Hedberg <johan.hedberg@intel.com>
Wed, 10 Jul 2013 10:55:04 +0000 (13:55 +0300)
committerJohan Hedberg <johan.hedberg@intel.com>
Wed, 10 Jul 2013 10:56:12 +0000 (13:56 +0300)
If services are already discovered through a Device1.Connect() call we
should not retry discovering them when Device1.Pair() is called.

src/device.c

index 88a7b86..0ec23a1 100644 (file)
@@ -3793,6 +3793,20 @@ void device_bonding_complete(struct btd_device *device, uint8_t status)
 
        device_set_paired(device, TRUE);
 
+       /* If services are already resolved just reply to the pairing
+        * request
+        */
+       if (device->svc_resolved && bonding) {
+               DBusMessage *reply;
+
+               reply = dbus_message_new_method_return(bonding->msg);
+               g_dbus_send_message(dbus_conn, reply);
+
+               bonding_request_free(bonding);
+
+               return;
+       }
+
        /* If we were initiators start service discovery immediately.
         * However if the other end was the initator wait a few seconds
         * before SDP. This is due to potential IOP issues if the other