From 5a23ff9478f79a80e50f7756fb2a0152b6b7111e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nu=C8=9Biu?= Date: Fri, 15 Dec 2017 21:32:22 +0200 Subject: [PATCH] Hotfixing shutdown --- server/server/connection.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/server/server/connection.go b/server/server/connection.go index 4c51aff..8eadcc4 100644 --- a/server/server/connection.go +++ b/server/server/connection.go @@ -36,9 +36,9 @@ var uploadDirectory string var uploadTimeout time.Duration // Shutdown is the shutdown where SIGINT and SIGTERM is send too -var Shutdown = make(chan os.Signal, 1) -var ftpShutdown = make(chan struct{}, 1) -var uploadShutdown = make(chan struct{}, 1) +var Shutdown = make(chan os.Signal) +var ftpShutdown = make(chan struct{}) +var uploadShutdown = make(chan struct{}) var uploadListener net.Listener var ftpListener net.Listener @@ -101,18 +101,20 @@ func shutdownHandler() { }() wg.Wait() - ShutdownFtpServer() ShutdownUploadServer() + ShutdownFtpServer() return } } } func ShutdownUploadServer() { - if uploadListener != nil { - uploadListener.Close() + if viper.GetBool("upload.enabled") == true { + if uploadListener != nil { + uploadListener.Close() + } + uploadShutdown <- struct{}{} } - uploadShutdown <- struct{}{} } func ShutdownFtpServer() {