Skip to content

Commit

Permalink
service: Always notify pending D-Bus clients of disconnect
Browse files Browse the repository at this point in the history
If a connecting service is disconnected, the D-Bus client that started
the connect must always be notified. Properly notify the pending D-Bus
client in the global function and clean up usage of reply_pending() when
the reply_pending() function is followed with a call to disconnect.
  • Loading branch information
pfl committed Aug 6, 2013
1 parent 862159c commit 6fd9e3f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/service.c
Expand Up @@ -3767,10 +3767,6 @@ static DBusMessage *connect_service(DBusConnection *conn,
if (service->type == temp->type &&
is_connecting(temp) &&
!is_interface_available(service, temp)) {
if (temp->pending != NULL)
__connman_service_return_error(temp,
ECONNABORTED,
NULL);

err = __connman_service_disconnect(temp);
if (err < 0 && err != -EINPROGRESS)
Expand Down Expand Up @@ -3816,8 +3812,6 @@ static DBusMessage *disconnect_service(DBusConnection *conn,

DBG("service %p", service);

reply_pending(service, ECONNABORTED);

service->ignore = true;

set_reconnect_state(service, false);
Expand Down Expand Up @@ -4450,7 +4444,6 @@ void connman_service_unref_debug(struct connman_service *service,

service_list = g_list_remove(service_list, service);

reply_pending(service, ECONNABORTED);
__connman_service_disconnect(service);

g_hash_table_remove(service_hash, service->identifier);
Expand Down Expand Up @@ -5114,7 +5107,6 @@ static int service_indicate_state(struct connman_service *service)

if (new_state == CONNMAN_SERVICE_STATE_IDLE &&
old_state != CONNMAN_SERVICE_STATE_DISCONNECT) {
reply_pending(service, ECONNABORTED);

__connman_service_disconnect(service);
}
Expand Down Expand Up @@ -5816,6 +5808,8 @@ int __connman_service_disconnect(struct connman_service *service)

connman_agent_cancel(service);

reply_pending(service, ECONNABORTED);

if (service->network != NULL) {
err = __connman_network_disconnect(service->network);
} else if (service->type == CONNMAN_SERVICE_TYPE_VPN &&
Expand Down

0 comments on commit 6fd9e3f

Please sign in to comment.