core: Do not change service state in btd_service_connect if it fails
Luiz Augusto von Dentz
maintainerPATCH 1/1 core: Do not change service state in btd_service_connect if it fails
From: Luiz Augusto von Dentz <[email protected]>
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(-)
src/service.c +3 -5
@@ -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; }
Signature · 1 line
1.8.3.1
Johan Hedberg
AppliedHi Luiz,
Quoted 6 lines · Luiz Augusto von Dentz
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(-)
Applied. Thanks.
Johan