Emit a ALERT_SHUTDOWN_SIGNAL before shutting down the daemon
authorMartin Willi <martin@strongswan.org>
Tue, 22 Sep 2009 14:59:25 +0000 (16:59 +0200)
committerMartin Willi <martin@strongswan.org>
Tue, 22 Sep 2009 15:00:00 +0000 (17:00 +0200)
src/charon/bus/bus.h
src/charon/daemon.c

index 9a4492f..7270c5c 100644 (file)
@@ -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,
 };
 
 /**
index a1ec3ad..490357c 100644 (file)
@@ -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: