Avoid panic during stop
This commit is contained in:
parent
a80cca95a2
commit
f3aefe282c
1 changed files with 26 additions and 20 deletions
|
@ -137,6 +137,7 @@ type serverEntryPoint struct {
|
||||||
|
|
||||||
func (s serverEntryPoint) Shutdown(ctx context.Context) {
|
func (s serverEntryPoint) Shutdown(ctx context.Context) {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
if s.httpServer != nil {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
@ -150,6 +151,9 @@ func (s serverEntryPoint) Shutdown(ctx context.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
if s.hijackConnectionTracker != nil {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
@ -160,6 +164,8 @@ func (s serverEntryPoint) Shutdown(ctx context.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue