From 8366c8d2a7cdf78e1abed05343fa413fa4adbdc5 Mon Sep 17 00:00:00 2001
From: orignal <i2porignal@yandex.ru>
Date: Tue, 29 Mar 2016 21:37:30 -0400
Subject: [PATCH] don't initiate graceful shutdown twice

---
 DaemonLinux.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/DaemonLinux.cpp b/DaemonLinux.cpp
index f91f782a..b408fc70 100644
--- a/DaemonLinux.cpp
+++ b/DaemonLinux.cpp
@@ -23,9 +23,14 @@ void handle_signal(int sig)
 			i2p::log::Logger().Reopen ();
 		break;
 		case SIGINT:
-			i2p::context.SetAcceptsTunnels (false);
-			Daemon.gracefullShutdownInterval = 10*60; // 10 minutes
-			LogPrint(eLogInfo, "Graceful shutdown after ", Daemon.gracefullShutdownInterval, " seconds");
+			if (i2p::context.AcceptsTunnels () && !Daemon.gracefullShutdownInterval)
+			{	
+				i2p::context.SetAcceptsTunnels (false);
+				Daemon.gracefullShutdownInterval = 10*60; // 10 minutes
+				LogPrint(eLogInfo, "Graceful shutdown after ", Daemon.gracefullShutdownInterval, " seconds");
+			}	
+			else
+				Daemon.running = 0; 
 		break;	
 		case SIGABRT:
 		case SIGTERM: