transport: Fix a data race when headers are received while the stream is being closed (#1814)
This commit is contained in:
@ -1116,13 +1116,14 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) {
|
||||
}()
|
||||
|
||||
s.mu.Lock()
|
||||
if !s.headerDone {
|
||||
// Headers frame is not actually a trailers-only frame.
|
||||
if !endStream {
|
||||
s.recvCompress = state.encoding
|
||||
}
|
||||
if !s.headerDone {
|
||||
if !endStream && len(state.mdata) > 0 {
|
||||
if len(state.mdata) > 0 {
|
||||
s.header = state.mdata
|
||||
}
|
||||
}
|
||||
close(s.headerChan)
|
||||
s.headerDone = true
|
||||
isHeader = true
|
||||
|
Reference in New Issue
Block a user