From d7d8f8bdb7c1ddae098893e10608fcb42034a9ff Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 25 Mar 2013 13:45:25 +0200 Subject: 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 --- src/service.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/service.c') 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); } -- cgit v1.2.3