* [PATCH BlueZ] core: Fix calling profile .connect multiple times
@ 2013-02-08 9:51 Luiz Augusto von Dentz
2013-02-15 10:53 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2013-02-08 9:51 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Sometimes profiles may complete the connection in different order
than expected so the code has to check if it was actually the
current pending profile to proceed to the next.
---
src/device.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/device.c b/src/device.c
index 49f8957..8ee7659 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1085,8 +1085,14 @@ static int connect_next(struct btd_device *dev)
void device_profile_connected(struct btd_device *dev,
struct btd_profile *profile, int err)
{
+ struct btd_profile *pending;
+
DBG("%s %s (%d)", profile->name, strerror(-err), -err);
+ if (dev->pending == NULL)
+ return;
+
+ pending = dev->pending->data;
dev->pending = g_slist_remove(dev->pending, profile);
if (!err)
@@ -1094,6 +1100,13 @@ void device_profile_connected(struct btd_device *dev,
g_slist_append(dev->connected_profiles,
profile);
+ /* Only continue connecting the next profile if it matches the first
+ * pending, otherwise it will trigger another connect to the same
+ * profile
+ */
+ if (profile != pending)
+ return;
+
if (connect_next(dev) == 0)
return;
--
1.8.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH BlueZ] core: Fix calling profile .connect multiple times
2013-02-08 9:51 [PATCH BlueZ] core: Fix calling profile .connect multiple times Luiz Augusto von Dentz
@ 2013-02-15 10:53 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2013-02-15 10:53 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hi Luiz,
On Fri, Feb 08, 2013, Luiz Augusto von Dentz wrote:
> Sometimes profiles may complete the connection in different order
> than expected so the code has to check if it was actually the
> current pending profile to proceed to the next.
> ---
> src/device.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
Applied. Thanks.
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-02-15 10:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-08 9:51 [PATCH BlueZ] core: Fix calling profile .connect multiple times Luiz Augusto von Dentz
2013-02-15 10:53 ` Johan Hedberg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.