Skip to contentSkip to conversation

core/service: Fix setting wrong state after calling accept

PATCH New Luiz Augusto von Dentz 1 participant 1 message Sep 8, 2016 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 core/service: Fix setting wrong state after calling accept

From: Luiz Augusto von Dentz <[email protected]>

The accept calback may transit the state to connected on the call itself since most of the time it is just a matter of selecting the attributes in case of GATT profiles.

---
 src/service.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/service.c +2 -1
index f387fc4..20a41d0 100644
@@ -209,7 +209,8 @@ int service_accept(struct btd_service *service)
 	return err;
 
 done:
-	change_state(service, BTD_SERVICE_STATE_CONNECTING, 0);
+	if (service->state == BTD_SERVICE_STATE_DISCONNECTED)
+		change_state(service, BTD_SERVICE_STATE_CONNECTING, 0);
 	return 0;
 }
 
Signature · 1 line
2.7.4