Hotfixing shutdown
This commit is contained in:
parent
58f80eda14
commit
5a23ff9478
1 changed files with 9 additions and 7 deletions
|
@ -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,19 +101,21 @@ func shutdownHandler() {
|
|||
}()
|
||||
wg.Wait()
|
||||
|
||||
ShutdownFtpServer()
|
||||
ShutdownUploadServer()
|
||||
ShutdownFtpServer()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func ShutdownUploadServer() {
|
||||
if viper.GetBool("upload.enabled") == true {
|
||||
if uploadListener != nil {
|
||||
uploadListener.Close()
|
||||
}
|
||||
uploadShutdown <- struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
func ShutdownFtpServer() {
|
||||
if ftpListener != nil {
|
||||
|
|
Loading…
Reference in a new issue