From dfbefee4771d17da3d95f72ef369fabd9b7649ab Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 26 Jan 2018 14:34:05 -0500 Subject: [PATCH] graceful shutdown complete if no transit tunnels anymore --- daemon/UnixDaemon.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/daemon/UnixDaemon.cpp b/daemon/UnixDaemon.cpp index 075aa7d8..a9c48fee 100644 --- a/daemon/UnixDaemon.cpp +++ b/daemon/UnixDaemon.cpp @@ -13,6 +13,7 @@ #include "Config.h" #include "FS.h" #include "Log.h" +#include "Tunnel.h" #include "RouterContext.h" #include "ClientContext.h" @@ -163,7 +164,7 @@ namespace i2p sigaction(SIGABRT, &sa, 0); sigaction(SIGTERM, &sa, 0); sigaction(SIGINT, &sa, 0); - sigaction(SIGPIPE, &sa, 0); + sigaction(SIGPIPE, &sa, 0); return Daemon_Singleton::start(); } @@ -183,7 +184,7 @@ namespace i2p if (gracefulShutdownInterval) { gracefulShutdownInterval--; // - 1 second - if (gracefulShutdownInterval <= 0) + if (gracefulShutdownInterval <= 0 || i2p::tunnel::tunnels.CountTransitTunnels() <= 0) { LogPrint(eLogInfo, "Graceful shutdown"); return;