summaryrefslogtreecommitdiff
path: root/src/service.c
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2013-03-25 13:45:25 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-03-27 15:21:21 +0200
commitd7d8f8bdb7c1ddae098893e10608fcb42034a9ff (patch)
tree4660ca7f84738b4defa28b095496f0592632be23 /src/service.c
parent458ef68f7c01b5b4735848547212a34e2030578d (diff)
downloadconnman-d7d8f8bdb7c1ddae098893e10608fcb42034a9ff.tar.gz
connman-d7d8f8bdb7c1ddae098893e10608fcb42034a9ff.tar.bz2
connman-d7d8f8bdb7c1ddae098893e10608fcb42034a9ff.zip
service: Disconnect the connecting service when needed
If we are trying to connect a service and there is another service connecting, then we disconnect the pending service and connect the new one. Fixes BMC#25981
Diffstat (limited to 'src/service.c')
-rw-r--r--src/service.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/service.c b/src/service.c
index 78e904f8..469140a2 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3789,8 +3789,18 @@ static DBusMessage *connect_service(DBusConnection *conn,
if (service->type == temp->type &&
is_connecting(temp) == TRUE &&
is_interface_available(service,
- temp) == FALSE)
- return __connman_error_in_progress(msg);
+ temp) == FALSE) {
+ if (temp->pending != NULL)
+ __connman_service_return_error(temp,
+ ECONNABORTED,
+ NULL);
+
+ err = __connman_service_disconnect(temp);
+ if (err < 0 && err != -EINPROGRESS)
+ return __connman_error_in_progress(msg);
+ else
+ break;
+ }
iter = g_sequence_iter_next(iter);
}