Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
s-matyukevich committed Feb 1, 2024
1 parent f61ec45 commit cac6dc2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,10 @@ func (s *Server) serveStreams(ctx context.Context, st transport.ServerTransport,
}

defer func() {
// The client might not be done reading all the data, which at this point
// is stored in the kernel TCP buffer, yet. If we close the connection right away
// the client will get RST and the request will fail. Delay closing for 1 sec.
// See more details in https://github.com/grpc/grpc-go/pull/6957
time.Sleep(goAwayTimeout)
st.Close(errors.New("finished serving streams for the server transport"))
for _, sh := range s.opts.statsHandlers {
Expand Down

0 comments on commit cac6dc2

Please sign in to comment.