diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2016-10-24 19:32:57 +0300 |
---|---|---|
committer | Szymon Janc <szymon.janc@codecoup.pl> | 2016-10-24 21:18:27 +0200 |
commit | ccd29841c3799c68ed90eb050661ffeccea78c9b (patch) | |
tree | 5bed5b29a063293bc9734826032528a155001254 /src/service.c | |
parent | 206bee144e2b7e3190677ffbf4f231dd2e728f5c (diff) | |
download | bluez-ccd29841c3799c68ed90eb050661ffeccea78c9b.tar.gz |
core/profile: Fix calling service_accept
service_accept shall only be used with profiles that implement .accept
callback, to set connecting state directly use service_set_connecting
which does not require .accept to be implemented.
Diffstat (limited to 'src/service.c')
-rw-r--r-- | src/service.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/service.c b/src/service.c index 20a41d052..207ffaea8 100644 --- a/src/service.c +++ b/src/service.c @@ -214,6 +214,25 @@ done: return 0; } +int service_set_connecting(struct btd_service *service) +{ + switch (service->state) { + case BTD_SERVICE_STATE_UNAVAILABLE: + return -EINVAL; + case BTD_SERVICE_STATE_DISCONNECTED: + break; + case BTD_SERVICE_STATE_CONNECTING: + case BTD_SERVICE_STATE_CONNECTED: + return 0; + case BTD_SERVICE_STATE_DISCONNECTING: + return -EBUSY; + } + + change_state(service, BTD_SERVICE_STATE_CONNECTING, 0); + + return 0; +} + int btd_service_connect(struct btd_service *service) { struct btd_profile *profile = service->profile; |