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
|
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,19 +101,21 @@ 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() {
|
||||||
if ftpListener != nil {
|
if ftpListener != nil {
|
||||||
|
|
Loading…
Reference in a new issue