clean up underlying footprint when Stream.Done() is read

This commit is contained in:
iamqizhao
2016-07-15 14:53:49 -07:00
parent 0223eb7067
commit c9f0b89a96
2 changed files with 4 additions and 1 deletions

View File

@ -190,7 +190,8 @@ func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth
case <-t.Error():
// Incur transport error, simply exit.
case <-s.Done():
// Simply exit. Leave the next I/O op to do cleanup.
cs.finish(err)
cs.closeTransportStream(nil)
case <-s.Context().Done():
err := s.Context().Err()
cs.finish(err)

View File

@ -692,6 +692,8 @@ func (t *http2Client) handleRSTStream(f *http2.RSTStreamFrame) {
grpclog.Println("transport: http2Client.handleRSTStream found no mapped gRPC status for the received http2 error ", f.ErrCode)
s.statusCode = codes.Unknown
}
//grpclog.Println("DEBUG handleRSTStram: ", f, " | ", f.ErrCode)
close(s.done)
s.mu.Unlock()
s.write(recvMsg{err: io.EOF})
}