-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added a GOAWAY frame send on client transport shutdown #4248
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -863,6 +863,13 @@ func (t *http2Client) Close() error { | |
// should unblock it so that the goroutine eventually exits. | ||
t.kpDormancyCond.Signal() | ||
} | ||
// The HTTP/2 spec mentions that a GOAWAY frame should be sent before a connection close. If this close() function | ||
// ever starts to take in an HTTP/2 error code the peer will be able to get more information about the reason | ||
// behind the connection close. | ||
if err := t.framer.fr.WriteGoAway(math.MaxUint32, http2.ErrCodeNo, []byte{}); err != nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's possible we want to do some refactoring here. I think I was expecting we'd pass an |
||
t.mu.Unlock() | ||
return err | ||
} | ||
t.mu.Unlock() | ||
t.controlBuf.finish() | ||
t.cancel() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If writing the GOAWAY fails, we still need to close the conn and do the other cleanup below, like adding an error to any streams that are still open.