* [PATCH BlueZ] core: Do not change service state in btd_service_connect if it fails
@ 2013-11-14 12:27 Luiz Augusto von Dentz
2013-11-14 12:59 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2013-11-14 12:27 UTC (permalink / raw)
To: linux-bluetooth
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-11-14 12:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-14 12:27 [PATCH BlueZ] core: Do not change service state in btd_service_connect if it fails Luiz Augusto von Dentz
2013-11-14 12:59 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox