]> code.delx.au - pulseaudio/commitdiff
bluetooth: Check if BlueZ tries to set the configuration twice for the same transport.
authorTanu Kaskinen <tanuk@iki.fi>
Thu, 6 Dec 2012 04:49:22 +0000 (06:49 +0200)
committerTanu Kaskinen <tanuk@iki.fi>
Wed, 19 Dec 2012 10:31:48 +0000 (12:31 +0200)
src/modules/bluetooth/bluetooth-util.c

index 91ad269a6fa21efc9209ea41811b88dd093ce2cd..498f5bb4317a40bdfebb760371aa0d821b806381 100644 (file)
@@ -1113,6 +1113,12 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
     dbus_message_iter_init(m, &args);
 
     dbus_message_iter_get_basic(&args, &path);
+
+    if (pa_hashmap_get(y->transports, path)) {
+        pa_log("org.bluez.MediaEndpoint.SetConfiguration: Transport %s is already configured.", path);
+        goto fail;
+    }
+
     if (!dbus_message_iter_next(&args))
         goto fail;
 
@@ -1183,7 +1189,7 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
         t->nrec = nrec;
 
     d->transports[p] = t;
-    pa_hashmap_put(y->transports, t->path, t);
+    pa_assert_se(pa_hashmap_put(y->transports, t->path, t) >= 0);
 
     pa_log_debug("Transport %s profile %d available", t->path, t->profile);