Simplify handling of terminating signals in all libcharon wrappers
Closes strongswan/strongswan#182.
This commit is contained in:
@@ -134,14 +134,10 @@ static int run()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SIGINT:
|
case SIGINT:
|
||||||
{
|
|
||||||
DBG1(DBG_DMN, "signal of type SIGINT received. Shutting down");
|
|
||||||
charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
{
|
{
|
||||||
DBG1(DBG_DMN, "signal of type SIGTERM received. Shutting down");
|
DBG1(DBG_DMN, "%s received, shutting down",
|
||||||
|
sig == SIGINT ? "SIGINT" : "SIGTERM");
|
||||||
charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
|
charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,14 +94,10 @@ static void run()
|
|||||||
switch (sig)
|
switch (sig)
|
||||||
{
|
{
|
||||||
case SIGINT:
|
case SIGINT:
|
||||||
{
|
|
||||||
DBG1(DBG_DMN, "signal of type SIGINT received. Shutting down");
|
|
||||||
charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
{
|
{
|
||||||
DBG1(DBG_DMN, "signal of type SIGTERM received. Shutting down");
|
DBG1(DBG_DMN, "%s received, shutting down",
|
||||||
|
sig == SIGINT ? "SIGINT" : "SIGTERM");
|
||||||
charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
|
charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,14 +118,10 @@ static void run()
|
|||||||
switch (sig)
|
switch (sig)
|
||||||
{
|
{
|
||||||
case SIGINT:
|
case SIGINT:
|
||||||
{
|
|
||||||
DBG1(DBG_DMN, "signal of type SIGINT received. Shutting down");
|
|
||||||
charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
{
|
{
|
||||||
DBG1(DBG_DMN, "signal of type SIGTERM received. Shutting down");
|
DBG1(DBG_DMN, "%s received, shutting down",
|
||||||
|
sig == SIGINT ? "SIGINT" : "SIGTERM");
|
||||||
charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
|
charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-6
@@ -126,14 +126,10 @@ static void run()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SIGINT:
|
case SIGINT:
|
||||||
{
|
|
||||||
DBG1(DBG_DMN, "signal of type SIGINT received. Shutting down");
|
|
||||||
charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
{
|
{
|
||||||
DBG1(DBG_DMN, "signal of type SIGTERM received. Shutting down");
|
DBG1(DBG_DMN, "%s received, shutting down",
|
||||||
|
sig == SIGINT ? "SIGINT" : "SIGTERM");
|
||||||
charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
|
charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,11 +92,9 @@ static int run()
|
|||||||
switch (sig)
|
switch (sig)
|
||||||
{
|
{
|
||||||
case SIGINT:
|
case SIGINT:
|
||||||
DBG1(DBG_DMN, "signal of type SIGINT received. Shutting down");
|
|
||||||
charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
|
|
||||||
return 0;
|
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
DBG1(DBG_DMN, "signal of type SIGTERM received. Shutting down");
|
DBG1(DBG_DMN, "%s received, shutting down",
|
||||||
|
sig == SIGINT ? "SIGINT" : "SIGTERM");
|
||||||
charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
|
charon->bus->alert(charon->bus, ALERT_SHUTDOWN_SIGNAL, sig);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user