From b262680175d1b18a2884e0f95206264737dcc621 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Tue, 22 Sep 2009 16:59:25 +0200 Subject: [PATCH] Emit a ALERT_SHUTDOWN_SIGNAL before shutting down the daemon --- src/charon/bus/bus.h | 2 ++ src/charon/daemon.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/charon/bus/bus.h b/src/charon/bus/bus.h index 9a4492ffc..7270c5c67 100644 --- a/src/charon/bus/bus.h +++ b/src/charon/bus/bus.h @@ -133,6 +133,8 @@ enum level_t { enum alert_t { /* a RADIUS server did not respond, no additional arguments */ ALERT_RADIUS_NOT_RESPONDING, + /* a shutdown signal has been received, argument is a int with the signal */ + ALERT_SHUTDOWN_SIGNAL, }; /** diff --git a/src/charon/daemon.c b/src/charon/daemon.c index a1ec3adef..490357c13 100644 --- a/src/charon/daemon.c +++ b/src/charon/daemon.c @@ -145,11 +145,13 @@ static void run(private_daemon_t *this) case SIGINT: { DBG1(DBG_DMN, "signal of type SIGINT received. Shutting down"); + charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig); return; } case SIGTERM: { DBG1(DBG_DMN, "signal of type SIGTERM received. Shutting down"); + charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig); return; } default: