From 39b9e120eb6e85f18e67679b4c3fe2823ba4c92d Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 7 Jul 2015 13:31:44 +0300 Subject: [PATCH] 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. --- src/profile.c | 9 +++++++-- 1 file 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); -- 2.47.3