From bb3a919f75fcd5b353ba03bae7afca947dbc7ef9 Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarek Date: Wed, 4 Jun 2014 17:14:45 +0200 Subject: [PATCH] profiles/audio: Fix propagation of EHOSTDOWN error 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. Change-Id: I2a2f802c582214170f7a2c8d89a550c72d07efab Signed-off-by: Sebastian Chlad --- 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; } -- 2.7.4