allow multiple GoAways and retrying on illegal streams

This commit is contained in:
iamqizhao
2016-07-25 16:35:32 -07:00
parent e40dc9bff9
commit f1e4d3b180
8 changed files with 54 additions and 25 deletions

View File

@ -795,12 +795,16 @@ func (s *Server) Stop() {
// connections and RPCs and blocks until all the pending RPCs are finished.
func (s *Server) GracefulStop() {
s.mu.Lock()
if s.drain == true || s.conns == nil {
s.mu.Lock()
return
}
s.drain = true
for lis := range s.lis {
lis.Close()
}
for c := range s.conns {
c.(transport.ServerTransport).GoAway()
c.(transport.ServerTransport).Drain()
}
for len(s.conns) != 0 {
s.cv.Wait()