summaryrefslogtreecommitdiff
path: root/src/profile.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2015-07-07 13:31:44 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2015-07-07 15:13:44 +0300
commit39b9e120eb6e85f18e67679b4c3fe2823ba4c92d (patch)
tree246a79d3bbbb156fe3cc23a126a5340d4f469b74 /src/profile.c
parentc73c1002331b2c0de0eaf555b5f1d05149f9a3b0 (diff)
downloadbluez-39b9e120eb6e85f18e67679b4c3fe2823ba4c92d.tar.gz
core/profiles: Fix not handling disconnections properly
If a profiles disconnects while in connecting state but ext_connect has already been called the state is never updated since ext_io_disconnected always calls btd_service_disconnecting_complete.
Diffstat (limited to 'src/profile.c')
-rw-r--r--src/profile.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/profile.c b/src/profile.c
index 4e68afc2a..4b7302630 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -797,8 +797,13 @@ static gboolean ext_io_disconnected(GIOChannel *io, GIOCondition cond,
DBG("%s disconnected from %s", ext->name, addr);
drop:
- if (conn->service)
- btd_service_disconnecting_complete(conn->service, 0);
+ if (conn->service) {
+ if (btd_service_get_state(conn->service) ==
+ BTD_SERVICE_STATE_CONNECTING)
+ btd_service_connecting_complete(conn->service, -EIO);
+ else
+ btd_service_disconnecting_complete(conn->service, 0);
+ }
ext->conns = g_slist_remove(ext->conns, conn);
ext_io_destroy(conn);