summaryrefslogtreecommitdiff
path: root/src/service.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2016-10-24 19:32:57 +0300
committerSzymon Janc <szymon.janc@codecoup.pl>2016-10-24 21:18:27 +0200
commitccd29841c3799c68ed90eb050661ffeccea78c9b (patch)
tree5bed5b29a063293bc9734826032528a155001254 /src/service.c
parent206bee144e2b7e3190677ffbf4f231dd2e728f5c (diff)
downloadbluez-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.c19
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;