summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2012-09-03 14:17:14 +0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-09-04 12:09:16 +0300
commitab0b83fe24b451e26ee8c26d201ca300946097f0 (patch)
treeba9c532cd868d9b114b0cd251a4d545ab5c65f25
parenta79d3c464d7eec5ae071f1b94faadbc3733fe1e4 (diff)
downloadconnman-ab0b83fe24b451e26ee8c26d201ca300946097f0.tar.gz
connman-ab0b83fe24b451e26ee8c26d201ca300946097f0.tar.bz2
connman-ab0b83fe24b451e26ee8c26d201ca300946097f0.zip
agent: Cancel agent requests
Clean up any queued Agent API messages when the agent disappears or the service is disconnected. Send cancel to the agent on D-Bus timeout.
-rw-r--r--src/agent.c9
-rw-r--r--src/service.c2
2 files changed, 11 insertions, 0 deletions
diff --git a/src/agent.c b/src/agent.c
index 132aa858..aff41dfe 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -59,6 +59,8 @@ static void agent_free(void)
g_free(agent_path);
agent_path = NULL;
+
+ __connman_agent_cancel(NULL);
}
static void agent_disconnect(DBusConnection *conn, void *data)
@@ -186,6 +188,13 @@ static void agent_receive_message(DBusPendingCall *call, void *user_data)
dbus_pending_call_unref(call);
queue_data->call = NULL;
+ if (dbus_message_is_error(reply, "org.freedesktop.DBus.Error.Timeout")
+ == TRUE || dbus_message_is_error(reply,
+ "org.freedesktop.DBus.Error.TimedOut")
+ == TRUE) {
+ agent_send_cancel();
+ }
+
queue_data->callback(reply, queue_data->user_data);
dbus_message_unref(reply);
diff --git a/src/service.c b/src/service.c
index 595381da..3e4c5bf4 100644
--- a/src/service.c
+++ b/src/service.c
@@ -5686,6 +5686,8 @@ int __connman_service_disconnect(struct connman_service *service)
DBG("service %p", service);
+ __connman_agent_cancel(service);
+
if (service->network != NULL) {
err = __connman_network_disconnect(service->network);
} else if (service->type == CONNMAN_SERVICE_TYPE_VPN &&