core/service: Fix setting wrong state after calling accept
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.
diff --git a/src/service.c b/src/service.c
index f387fc4..20a41d0 100644
--- a/src/service.c
+++ b/src/service.c
@@ -209,7 +209,8 @@
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;
}