main: Restore agent_exit call before main loop exit

This commit is contained in:
Andrew Zaborowski 2016-05-25 01:37:19 +02:00 committed by Denis Kenzior
parent 176a5bcf76
commit 2901cb1169
5 changed files with 16 additions and 4 deletions

View File

@ -447,11 +447,14 @@ bool agent_init(struct l_dbus *dbus)
bool agent_exit(struct l_dbus *dbus)
{
if (default_agent)
release_agent(default_agent);
l_dbus_unregister_object(dbus, IWD_AGENT_MANAGER_PATH);
l_dbus_unregister_interface(dbus, IWD_AGENT_MANAGER_INTERFACE);
return true;
}
void agent_shutdown(void)
{
if (default_agent)
release_agent(default_agent);
}

View File

@ -35,6 +35,7 @@ typedef void (*agent_request_passphrase_func_t) (enum agent_result result,
bool agent_init(struct l_dbus *dbus);
bool agent_exit(struct l_dbus *dbus);
bool agent_setup(struct l_dbus_interface *interface);
void agent_shutdown(void);
unsigned int agent_request_passphrase(const char *path,
agent_request_passphrase_func_t callback,

View File

@ -246,3 +246,9 @@ bool dbus_exit(void)
return true;
}
void dbus_shutdown(void)
{
/* Allow AgentManager to send a Release call before disconnecting */
agent_shutdown();
}

View File

@ -63,3 +63,4 @@ struct l_dbus_message *dbus_error_not_implemented(struct l_dbus_message *msg);
bool dbus_init(bool enable_debug, bool use_kdbus);
bool dbus_exit(void);
void dbus_shutdown(void);

View File

@ -36,7 +36,6 @@
#include "src/device.h"
#include "src/wiphy.h"
#include "src/dbus.h"
#include "src/agent.h"
#include "src/network.h"
#include "src/eapol.h"
#include "src/scan.h"
@ -59,6 +58,8 @@ static void signal_handler(struct l_signal *signal, uint32_t signo,
case SIGTERM:
l_info("Terminate");
dbus_shutdown();
timeout = l_timeout_create(1, main_loop_quit, NULL, NULL);
break;
}