manager_allow_headset_connection was considering the connection attempt
itself as a connection when it shouldn't.
GError *err = NULL;
GIOChannel *io;
- if (!manager_allow_headset_connection(&dev->src))
+ if (!manager_allow_headset_connection(dev))
return -ECONNREFUSED;
if (hs->rfcomm_ch < 0)
if (!device)
goto drop;
- if (!manager_allow_headset_connection(&device->src)) {
+ if (!manager_allow_headset_connection(device)) {
debug("Refusing headset: too many existing connections");
goto drop;
}
return dev;
}
-gboolean manager_allow_headset_connection(bdaddr_t *src)
+gboolean manager_allow_headset_connection(struct audio_device *device)
{
GSList *l;
int connected = 0;
struct audio_device *dev = l->data;
struct headset *hs = dev->headset;
- if (bacmp(&dev->src, src))
+ if (dev == device)
+ continue;
+
+ if (bacmp(&dev->src, &device->src))
continue;
if (!hs)
const bdaddr_t *dst,
gboolean create);
-gboolean manager_allow_headset_connection(bdaddr_t *src);
+gboolean manager_allow_headset_connection(struct audio_device *device);