From 724b9c045b5225db781b6a3ccfbdb275bb5a8e75 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 26 Jun 2013 14:11:33 -0500 Subject: [PATCH] agents: remove request_cancel() Turns out this function is useless, because it's only called when the agent has dropped off the bus or when the whole request is being freed. If the agent has dropped off the bus then there's no point in asking it to cancel the request because there's nothing to ask. So we can collapse request_cancel() into request_free(). --- src/settings/nm-agent-manager.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c index 36512cde39..bdede80e5f 100644 --- a/src/settings/nm-agent-manager.c +++ b/src/settings/nm-agent-manager.c @@ -121,7 +121,7 @@ remove_agent (NMAgentManager *self, const char *owner) if (!agent) return FALSE; - nm_log_dbg (LOGD_AGENTS, "(%s) agent unregistered", + nm_log_dbg (LOGD_AGENTS, "(%s) agent unregistered or disappeared", nm_secret_agent_get_description (agent)); /* Remove this agent to any in-progress secrets requests */ @@ -466,15 +466,6 @@ request_new (gsize struct_size, return req; } -static void -request_cancel (Request *req) -{ - if (req->cancel_callback) - req->cancel_callback (req); - req->current = NULL; - req->current_call_id = NULL; -} - static void request_free (Request *req) { @@ -484,7 +475,8 @@ request_free (Request *req) if (req->idle_id) g_source_remove (req->idle_id); - request_cancel (req); + if (req->cancel_callback) + req->cancel_callback (req); g_free (req->detail); g_free (req->verb); @@ -610,6 +602,9 @@ request_next_agent (Request *req) req->next_callback (req); } else { + req->current_call_id = NULL; + req->current = NULL; + /* No more secret agents are available to fulfill this secrets request */ error = g_error_new_literal (NM_AGENT_MANAGER_ERROR, NM_AGENT_MANAGER_ERROR_NO_SECRETS, @@ -628,10 +623,6 @@ request_remove_agent (Request *req, NMSecretAgent *agent) req->pending = g_slist_remove (req->pending, agent); if (agent == req->current) { - /* If this agent is being asked right now, cancel the request and send it - * to the next agent. - */ - request_cancel (req); nm_log_dbg (LOGD_AGENTS, "(%s) current agent removed from secrets request %p/%s", nm_secret_agent_get_description (agent), req, req->detail); request_next_agent (req);