Make sure all in-flight streams close when ClientConn.Close() is called. (#1136)

* Make sure all in-flight streams close when ClientConn.Close() is called.

* added test
This commit is contained in:
MakMukhi
2017-04-21 15:03:04 -07:00
committed by GitHub
parent 6d0e6b04b3
commit 2d949be2fe
2 changed files with 38 additions and 0 deletions

View File

@ -237,6 +237,9 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth
select {
case <-t.Error():
// Incur transport error, simply exit.
case <-cc.ctx.Done():
cs.finish(ErrClientConnClosing)
cs.closeTransportStream(ErrClientConnClosing)
case <-s.Done():
// TODO: The trace of the RPC is terminated here when there is no pending
// I/O, which is probably not the optimal solution.