From: Patrik Flykt <[email protected]>
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.
---
v2: send cancel also on dbus timeout
src/agent.c | 9 +++++++++
src/service.c | 2 ++
2 files changed, 11 insertions(+)
diff --git a/src/agent.c b/src/agent.c
index 2a9ef13..9b9b329 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)
@@ -190,6 +192,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 48187c4..1327fee 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 &&
--
1.7.10.4
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman