@@ -678,6 +678,11 @@ static bool release_agent(void *data, void *user_data)
return true;
}
+static void agent_shutdown(void)
+{
+ l_queue_foreach_remove(agents, release_agent, NULL);
+}
+
static int agent_init(void)
{
struct l_dbus *dbus = dbus_get_bus();
@@ -701,6 +706,8 @@ static int agent_init(void)
return -EIO;
}
+ __dbus_set_agent_shutdown_func(agent_shutdown);
+
return 0;
}
@@ -714,9 +721,4 @@ static void agent_exit(void)
agents = NULL;
}
-void agent_shutdown(void)
-{
- l_queue_foreach_remove(agents, release_agent, NULL);
-}
-
IWD_MODULE(agent, agent_init, agent_exit);
@@ -37,8 +37,6 @@ typedef void (*agent_request_user_name_passwd_func_t) (enum agent_result result,
void *user_data);
typedef void (*agent_request_destroy_func_t)(void *user_data);
-void agent_shutdown(void);
-
unsigned int agent_request_passphrase(const char *path,
agent_request_passphrase_func_t callback,
struct l_dbus_message *message,
@@ -30,11 +30,11 @@
#include <ell/ell.h>
-#include "src/agent.h"
#include "src/iwd.h"
#include "src/dbus.h"
static struct l_dbus *g_dbus = NULL;
+static dbus_agent_shutdown_func_t agent_shutdown;
struct l_dbus_message *dbus_error_busy(struct l_dbus_message *msg)
{
@@ -220,8 +220,14 @@ void dbus_exit(void)
g_dbus = NULL;
}
+void __dbus_set_agent_shutdown_func(dbus_agent_shutdown_func_t agent_shutdown)
+{
+ agent_shutdown = agent_shutdown;
+}
+
void dbus_shutdown(void)
{
/* Allow AgentManager to send a Release call before disconnecting */
- agent_shutdown();
+ if (agent_shutdown)
+ agent_shutdown();
}
@@ -51,10 +51,14 @@
#define IWD_AGENT_MANAGER_PATH IWD_BASE_PATH
#define IWD_P2P_SERVICE_MANAGER_PATH IWD_BASE_PATH
+typedef void (*dbus_agent_shutdown_func_t)(void);
+
struct l_dbus;
struct l_dbus *dbus_get_bus(void);
+void __dbus_set_agent_shutdown_func(dbus_agent_shutdown_func_t agent_shutdown);
+
void dbus_pending_reply(struct l_dbus_message **msg,
struct l_dbus_message *reply);
bool dbus_append_dict_basic(struct l_dbus_message_builder *builder,