Skip to content

Commit

Permalink
chore: revise comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ppzqh committed Sep 4, 2024
1 parent 862a0ba commit 210f81e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions pkg/remote/trans/nphttp2/grpc/http2_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,7 @@ func (t *http2Client) closeStream(s *Stream, err error, rst bool, rstCode http2.
<-s.done
return
}
// status and trailers can be updated here without any synchronization because the stream goroutine will
// only read it after it sees an io.EOF error from read or write and we'll write those errors
// only after updating this.
// status and trailers should be updated here with synchronization because Trailer() function may be called concurrently
s.status = st
if len(mdata) > 0 {
s.cliTlrMu.Lock()
Expand Down
3 changes: 2 additions & 1 deletion pkg/remote/trans/nphttp2/grpc/http2_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ import (
"math"
"testing"

"golang.org/x/net/http2"

"github.com/cloudwego/kitex/internal/test"
"github.com/cloudwego/kitex/pkg/remote/trans/nphttp2/codes"
"github.com/cloudwego/kitex/pkg/remote/trans/nphttp2/metadata"
"github.com/cloudwego/kitex/pkg/remote/trans/nphttp2/status"
"golang.org/x/net/http2"
)

func TestHttp2ClientTrailerRace(t *testing.T) {
Expand Down

0 comments on commit 210f81e

Please sign in to comment.