In case ACL connection failed to establish, all pending services shall
be always removed. At the moment it's only done in case there's pending
Connect message which does not take into account reconnect scenario,
i.e. service connection was triggered by reconnection timeout and there
is no pending message.
In such case, when reconnection failed there will be some services on
pending list and subsequent reconnect attempts will fail with EBUSY
immediately.
---
src/device.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/device.c b/src/device.c
index 8222610..a9b644b 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1220,6 +1220,9 @@ static void device_profile_connected(struct btd_device *dev,
return;
done:
+ g_slist_free(dev->pending);
+ dev->pending = NULL;
+
if (!dev->connect)
return;
@@ -1241,9 +1244,6 @@ done:
g_dbus_send_reply(dbus_conn, dev->connect, DBUS_TYPE_INVALID);
}
- g_slist_free(dev->pending);
- dev->pending = NULL;
-
dbus_message_unref(dev->connect);
dev->connect = NULL;
}
--
1.9.3
Hi Andrzej,
On Wed, Jun 04, 2014, Andrzej Kaczmarek wrote:
> In case ACL connection failed to establish, all pending services shall
> be always removed. At the moment it's only done in case there's pending
> Connect message which does not take into account reconnect scenario,
> i.e. service connection was triggered by reconnection timeout and there
> is no pending message.
>
> In such case, when reconnection failed there will be some services on
> pending list and subsequent reconnect attempts will fail with EBUSY
> immediately.
> ---
> src/device.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Both patches have been applied. Thanks.
Johan
EHOSTDOWN error is now overwritten by EIO and once it's passed to
device_profile_connected it triggers connection of another profiles
while it should actually stop connecting them.
---
profiles/audio/sink.c | 13 ++++++++-----
profiles/audio/source.c | 13 ++++++++-----
2 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/profiles/audio/sink.c b/profiles/audio/sink.c
index d16af23..da8992e 100644
--- a/profiles/audio/sink.c
+++ b/profiles/audio/sink.c
@@ -229,11 +229,14 @@ static void discovery_complete(struct avdtp *session, GSList *seps, struct avdtp
if (err) {
avdtp_unref(sink->session);
sink->session = NULL;
- if (avdtp_error_category(err) == AVDTP_ERRNO
- && avdtp_error_posix_errno(err) != EHOSTDOWN) {
- perr = -EAGAIN;
- } else
- perr = -EIO;
+
+ perr = -avdtp_error_posix_errno(err);
+ if (perr != -EHOSTDOWN) {
+ if (avdtp_error_category(err) == AVDTP_ERRNO)
+ perr = -EAGAIN;
+ else
+ perr = -EIO;
+ }
goto failed;
}
diff --git a/profiles/audio/source.c b/profiles/audio/source.c
index 843b3e8..b0abaa3 100644
--- a/profiles/audio/source.c
+++ b/profiles/audio/source.c
@@ -229,11 +229,14 @@ static void discovery_complete(struct avdtp *session, GSList *seps, struct avdtp
if (err) {
avdtp_unref(source->session);
source->session = NULL;
- if (avdtp_error_category(err) == AVDTP_ERRNO
- && avdtp_error_posix_errno(err) != EHOSTDOWN) {
- perr = -EAGAIN;
- } else
- perr = -EIO;
+
+ perr = -avdtp_error_posix_errno(err);
+ if (perr != -EHOSTDOWN) {
+ if (avdtp_error_category(err) == AVDTP_ERRNO)
+ perr = -EAGAIN;
+ else
+ perr = -EIO;
+ }
goto failed;
}
--
1.9.3