Avoid panic during stop

This commit is contained in:
NicoMen 2018-09-17 16:26:03 +02:00 committed by Traefiker Bot
parent a80cca95a2
commit f3aefe282c

View file

@ -137,6 +137,7 @@ type serverEntryPoint struct {
func (s serverEntryPoint) Shutdown(ctx context.Context) {
var wg sync.WaitGroup
if s.httpServer != nil {
wg.Add(1)
go func() {
defer wg.Done()
@ -150,6 +151,9 @@ func (s serverEntryPoint) Shutdown(ctx context.Context) {
}
}
}()
}
if s.hijackConnectionTracker != nil {
wg.Add(1)
go func() {
defer wg.Done()
@ -160,6 +164,8 @@ func (s serverEntryPoint) Shutdown(ctx context.Context) {
}
}
}()
}
wg.Wait()
}