Hotfixing shutdown

This commit is contained in:
Denis-Cosmin Nutiu 2017-12-15 21:32:22 +02:00
parent 58f80eda14
commit 5a23ff9478

View file

@ -36,9 +36,9 @@ var uploadDirectory string
var uploadTimeout time.Duration var uploadTimeout time.Duration
// Shutdown is the shutdown where SIGINT and SIGTERM is send too // Shutdown is the shutdown where SIGINT and SIGTERM is send too
var Shutdown = make(chan os.Signal, 1) var Shutdown = make(chan os.Signal)
var ftpShutdown = make(chan struct{}, 1) var ftpShutdown = make(chan struct{})
var uploadShutdown = make(chan struct{}, 1) var uploadShutdown = make(chan struct{})
var uploadListener net.Listener var uploadListener net.Listener
var ftpListener net.Listener var ftpListener net.Listener
@ -101,18 +101,20 @@ func shutdownHandler() {
}() }()
wg.Wait() wg.Wait()
ShutdownFtpServer()
ShutdownUploadServer() ShutdownUploadServer()
ShutdownFtpServer()
return return
} }
} }
} }
func ShutdownUploadServer() { func ShutdownUploadServer() {
if viper.GetBool("upload.enabled") == true {
if uploadListener != nil { if uploadListener != nil {
uploadListener.Close() uploadListener.Close()
} }
uploadShutdown <- struct{}{} uploadShutdown <- struct{}{}
}
} }
func ShutdownFtpServer() { func ShutdownFtpServer() {