Thread (12 messages) 12 messages, 2 authors, 2016-09-09

Re: [PATCH BlueZ 1/5] core/service: Fix setting wrong state after calling accept

flat view

From: Felipe Ferreri Tonello <hidden>
Date: 2016-09-08 14:45:26

Hi Luiz,

On 08/09/16 13:38, Luiz Augusto von Dentz wrote:
quoted hunk ↗ jump to hunk
From: Luiz Augusto von Dentz <redacted>

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(-)
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 @@ 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);
This looks really hacky - I know it was like this before already.

Why can you change the state in two different places? What if the
profile->accept doesn't change the state to connected? Will this change
to connecting and then the connected state will never be set?

I think btd_service_connecting_complete() should always be called with
the same err as returned by profile->accept()
 	return 0;
 }
 
-- 
Felipe

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help