3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-18 18:29:29 +01:00

agent: Make sure Release is sent when iwd exits

The main loop cannot be quit in signal handler as that would
prevent the agent.c from sending the Release command to the agent.
This commit is contained in:
Jukka Rissanen 2015-03-02 16:19:08 +02:00 committed by Denis Kenzior
parent 02a8eddd8f
commit e17d2d63c2
2 changed files with 13 additions and 3 deletions

View File

@ -33,6 +33,14 @@
#include "src/wiphy.h"
#include "src/kdbus.h"
#include "src/dbus.h"
#include "src/agent.h"
static struct l_timeout *timeout = NULL;
static void main_loop_quit(struct l_timeout *timeout, void *user_data)
{
l_main_quit();
}
static void signal_handler(struct l_signal *signal, uint32_t signo,
void *user_data)
@ -41,7 +49,10 @@ static void signal_handler(struct l_signal *signal, uint32_t signo,
case SIGINT:
case SIGTERM:
l_info("Terminate");
l_main_quit();
agent_exit();
timeout = l_timeout_create(1, main_loop_quit, NULL, NULL);
break;
}
}
@ -171,6 +182,7 @@ destroy:
done:
l_signal_remove(signal);
l_timeout_remove(timeout);
return exit_status;
}

View File

@ -132,7 +132,5 @@ bool manager_exit(struct l_dbus *dbus)
l_dbus_unregister_interface(dbus, IWD_MANAGER_PATH,
IWD_MANAGER_INTERFACE);
agent_exit();
return true;
}