Merge pull request #490 from iamqizhao/master
Specialize connection error handling
This commit is contained in:
@ -133,8 +133,12 @@ func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth
|
||||
// Listen on ctx.Done() to detect cancellation when there is no pending
|
||||
// I/O operations on this stream.
|
||||
go func() {
|
||||
<-s.Context().Done()
|
||||
cs.closeTransportStream(transport.ContextErr(s.Context().Err()))
|
||||
select {
|
||||
case <-t.Error():
|
||||
// Incur transport error, simply exit.
|
||||
case <-s.Context().Done():
|
||||
cs.closeTransportStream(transport.ContextErr(s.Context().Err()))
|
||||
}
|
||||
}()
|
||||
return cs, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user