commit | cd69bc3fc700721b709c3a59e16e24c67b58f6ff | [log] [tgz] |
---|---|---|
author | Tom Bergan <tombergan@google.com> | Tue Oct 17 13:25:22 2017 -0700 |
committer | Tom Bergan <tombergan@google.com> | Fri Oct 20 20:44:01 2017 +0000 |
tree | f0b1de7a05e3ec6297cd339b4ef870848eeb3c4e | |
parent | aabf50738bcdd9b207582cbe796b59ed65d56680 [diff] |
http2: always delay closing the connection after sending GOAWAY Currently, we close the connection immediately after sending a GOAWAY frame if all outstanding responses have been completely sent. However, the client may have had requests in-flight at that time which have been queued in the kernel receive buffer. On both Windows and Linux, if the connection is close()'d when the receive buffer is not empty, the kernel sends RST. This has the effect of aborting both sides of the connection, meaning the client may not actually receive all responses that were sent before the GOAWAY. Instead, we should delay calling close() until after the receive buffer has been drained. We don't want to delay indefinitely, which means we need some kind of timeout. Ideally that timeout should be about 1 RTT + epsilon, under the assumption that the client will not send any more frames after receiving the GOAWAY. However, 1 RTT is difficult to measure. It turns out we were already using a 1 second delay in other cases, so we reuse that same delay here. Note that we do not call CloseWrite() to half-close the underlying TLS connection. This seems unnecessary -- GOAWAY is effectively a half-close at the HTTP/2 level. Updates golang/go#18701 (fixes after it's bundled into net/http) Change-Id: I4d68bada6369ba95e5db02afe6dfad0a393c0334 Reviewed-on: https://go-review.googlesource.com/71372 Run-TryBot: Tom Bergan <tombergan@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
This repository holds supplementary Go networking libraries.
The easiest way to install is to run go get -u golang.org/x/net
. You can also manually git clone the repository to $GOPATH/src/golang.org/x/net
.
This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html. The main issue tracker for the net repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/net:” in the subject line, so it is easy to find.