Skip to content

Commit 2e0b66b

Browse files
authored
transport: fix race accessing s.recvCompress (#4627)
1 parent db2d595 commit 2e0b66b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/transport/http2_client.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1275,6 +1275,7 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) {
12751275
contentTypeErr string
12761276
grpcMessage string
12771277
statusGen *status.Status
1278+
recvCompress string
12781279

12791280
httpStatus string
12801281
rawStatus string
@@ -1292,7 +1293,7 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) {
12921293
mdata[hf.Name] = append(mdata[hf.Name], hf.Value)
12931294
isGRPC = true
12941295
case "grpc-encoding":
1295-
s.recvCompress = hf.Value
1296+
recvCompress = hf.Value
12961297
case "grpc-status":
12971298
rawStatus = hf.Value
12981299
case "grpc-message":
@@ -1384,6 +1385,7 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) {
13841385
// These values can be set without any synchronization because
13851386
// stream goroutine will read it only after seeing a closed
13861387
// headerChan which we'll close after setting this.
1388+
s.recvCompress = recvCompress
13871389
if len(mdata) > 0 {
13881390
s.header = mdata
13891391
}

0 commit comments

Comments
 (0)