diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2015-10-26 10:41:43 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2015-10-26 10:41:43 +0200 |
commit | 4522ac85dd6dc1db4d49507330b4abc3bbaf4e6c (patch) | |
tree | 22b74eb1989af33a974c3439cb182902381ca838 /src/service.c | |
parent | 68a2dd1ba822014ae10ae367dcf8e110b5e3f65c (diff) | |
download | bluez-4522ac85dd6dc1db4d49507330b4abc3bbaf4e6c.tar.gz |
core/service: Fix calling driver .accept multiple times
service_accept shall not call driver .accept callback multiple times.
Diffstat (limited to 'src/service.c')
-rw-r--r-- | src/service.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/service.c b/src/service.c index cae280488..2ed72fbec 100644 --- a/src/service.c +++ b/src/service.c @@ -184,6 +184,18 @@ int service_accept(struct btd_service *service) char addr[18]; int err; + 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 -EALREADY; + case BTD_SERVICE_STATE_DISCONNECTING: + return -EBUSY; + } + if (!service->profile->accept) goto done; |