Skip to content

Commit

Permalink
transport: remove unnecessary rstReceived (grpc#1834)
Browse files Browse the repository at this point in the history
  • Loading branch information
lyuxuan authored Jan 25, 2018
1 parent 0848a09 commit 5769e02
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 1 addition & 3 deletions transport/http2_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,6 @@ func (t *http2Client) CloseStream(s *Stream, err error) {
s.mu.Lock()
rstStream = s.rstStream
rstError = s.rstError
rstRecv := s.rstReceived
if s.state == streamDone {
s.mu.Unlock()
return
Expand All @@ -582,7 +581,7 @@ func (t *http2Client) CloseStream(s *Stream, err error) {
}
s.state = streamDone
s.mu.Unlock()
if err != nil && !rstStream && !rstRecv {
if err != nil && !rstStream {
rstStream = true
rstError = http2.ErrCodeCancel
}
Expand Down Expand Up @@ -920,7 +919,6 @@ func (t *http2Client) handleRSTStream(f *http2.RSTStreamFrame) {
statusCode = codes.Unknown
}
s.finish(status.Newf(statusCode, "stream terminated by RST_STREAM with error code: %v", f.ErrCode))
s.rstReceived = true
s.mu.Unlock()
s.write(recvMsg{err: io.EOF})
}
Expand Down
5 changes: 2 additions & 3 deletions transport/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,8 @@ type Stream struct {

status *status.Status // the status error received from the server

rstStream bool // indicates whether a RST_STREAM frame needs to be sent
rstError http2.ErrCode // the error that needs to be sent along with the RST_STREAM frame
rstReceived bool // indicates whether a RST_STREAM frame has been received from the other endpoint
rstStream bool // indicates whether a RST_STREAM frame needs to be sent
rstError http2.ErrCode // the error that needs to be sent along with the RST_STREAM frame

bytesReceived bool // indicates whether any bytes have been received on this stream
unprocessed bool // set if the server sends a refused stream or GOAWAY including this stream
Expand Down

0 comments on commit 5769e02

Please sign in to comment.