mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 17:59:25 +01:00
dbus: Use the shutdown procedure instead of l_main_quit
Move the calling of the *_shutdown functions from the signal handler to a new public function, and use that function inside the DBus disconnect handler to make sure resources are cleanly released.
This commit is contained in:
parent
faba9d509a
commit
33f8b1f53d
@ -31,6 +31,7 @@
|
||||
#include <ell/dbus-private.h>
|
||||
#include "src/dbus.h"
|
||||
#include "src/agent.h"
|
||||
#include "src/iwd.h"
|
||||
|
||||
struct l_dbus *g_dbus = 0;
|
||||
|
||||
@ -196,7 +197,7 @@ static void ready_callback(void *user_data)
|
||||
static void disconnect_callback(void *user_data)
|
||||
{
|
||||
l_info("D-Bus disconnected, quitting...");
|
||||
l_main_quit();
|
||||
iwd_shutdown();
|
||||
}
|
||||
|
||||
struct l_dbus *dbus_get_bus(void)
|
||||
|
@ -36,3 +36,5 @@ typedef void (*iwd_device_foreach_func)(struct device *, void *data);
|
||||
void __iwd_device_foreach(iwd_device_foreach_func func, void *user_data);
|
||||
|
||||
const struct l_settings *iwd_get_config(void);
|
||||
|
||||
void iwd_shutdown(void);
|
||||
|
14
src/main.c
14
src/main.c
@ -59,6 +59,14 @@ static void main_loop_quit(struct l_timeout *timeout, void *user_data)
|
||||
l_main_quit();
|
||||
}
|
||||
|
||||
void iwd_shutdown(void)
|
||||
{
|
||||
dbus_shutdown();
|
||||
netdev_shutdown();
|
||||
|
||||
timeout = l_timeout_create(1, main_loop_quit, NULL, NULL);
|
||||
}
|
||||
|
||||
static void signal_handler(struct l_signal *signal, uint32_t signo,
|
||||
void *user_data)
|
||||
{
|
||||
@ -66,11 +74,7 @@ static void signal_handler(struct l_signal *signal, uint32_t signo,
|
||||
case SIGINT:
|
||||
case SIGTERM:
|
||||
l_info("Terminate");
|
||||
|
||||
dbus_shutdown();
|
||||
netdev_shutdown();
|
||||
|
||||
timeout = l_timeout_create(1, main_loop_quit, NULL, NULL);
|
||||
iwd_shutdown();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user