Browse Source

fix freeze during server shutdown

pull/340/head
aler9 5 years ago
parent
commit
a9ff21278c
  1. 11
      internal/clientman/clientman.go
  2. 2
      internal/path/path.go

11
internal/clientman/clientman.go

@ -198,13 +198,22 @@ outer: @@ -198,13 +198,22 @@ outer:
}
go func() {
for range cm.clientClose {
for {
select {
case _, ok := <-cm.clientClose:
if !ok {
return
}
case <-cm.pathMan.ClientClose():
}
}
}()
for c := range cm.clients {
c.Close()
}
cm.wg.Wait()
close(cm.clientClose)

2
internal/path/path.go

@ -287,7 +287,6 @@ outer: @@ -287,7 +287,6 @@ outer:
delete(pa.clients, req.Client)
pa.clientsWg.Done()
close(req.Res)
case <-pa.terminate:
@ -419,7 +418,6 @@ func (pa *Path) exhaustChannels() { @@ -419,7 +418,6 @@ func (pa *Path) exhaustChannels() {
}
pa.clientsWg.Done()
close(req.Res)
}
}

Loading…
Cancel
Save