From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ] core: Do not change service state in btd_service_connect if it fails
Date: Thu, 14 Nov 2013 14:27:51 +0200 [thread overview]
Message-ID: <1384432071-2703-1-git-send-email-luiz.dentz@gmail.com> (raw)
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
If .connect fails and the service state changes it may re-enter
connect_next, inverting the order and messing up the error of each
connect request.
---
src/service.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/service.c b/src/service.c
index 52a8291..7a480d6 100644
--- a/src/service.c
+++ b/src/service.c
@@ -198,18 +198,16 @@ int btd_service_connect(struct btd_service *service)
return -EBUSY;
}
- change_state(service, BTD_SERVICE_STATE_CONNECTING, 0);
-
err = profile->connect(service);
- if (err == 0)
+ if (err == 0) {
+ change_state(service, BTD_SERVICE_STATE_CONNECTING, 0);
return 0;
+ }
ba2str(device_get_address(service->device), addr);
error("%s profile connect failed for %s: %s", profile->name, addr,
strerror(-err));
- btd_service_connecting_complete(service, err);
-
return err;
}
--
1.8.3.1
next reply other threads:[~2013-11-14 12:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-14 12:27 Luiz Augusto von Dentz [this message]
2013-11-14 12:59 ` [PATCH BlueZ] core: Do not change service state in btd_service_connect if it fails Johan Hedberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1384432071-2703-1-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox