diff options
| author | Michael Fraenkel <michael.fraenkel@gmail.com> | 2020-06-27 13:31:34 -0600 |
|---|---|---|
| committer | Emmanuel Odeke <emm.odeke@gmail.com> | 2020-09-06 17:26:55 +0000 |
| commit | 617f2c3e35cdc8483b950aa3ef18d92965d63197 (patch) | |
| tree | 2a30a1ebc3854a95206d0deecfc4604d1f94c040 /src/net/http/export_test.go | |
| parent | b60ec4cc4b230f4d0787acf82057947b8bf80cea (diff) | |
| download | go-617f2c3e35cdc8483b950aa3ef18d92965d63197.tar.xz | |
net/http: mark http/2 connections active
On Server.Shutdown, all idle connections are closed.
A caveat for new connections is that they are marked idle
after 5 seconds.
Previously new HTTP/2 connections were marked New, and after 5 seconds,
they would then become idle. With this change, we now mark HTTP/2
connections as Active to allow the proper shutdown sequence to occur.
Fixes #36946
Fixes #39776
Change-Id: I31efbf64b9a2850ca544da797f86d7e1b3378e8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/240278
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/net/http/export_test.go')
| -rw-r--r-- | src/net/http/export_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/net/http/export_test.go b/src/net/http/export_test.go index 657ff9dba4..67a74ae19f 100644 --- a/src/net/http/export_test.go +++ b/src/net/http/export_test.go @@ -274,6 +274,17 @@ func (s *Server) ExportAllConnsIdle() bool { return true } +func (s *Server) ExportAllConnsByState() map[ConnState]int { + states := map[ConnState]int{} + s.mu.Lock() + defer s.mu.Unlock() + for c := range s.activeConn { + st, _ := c.getState() + states[st] += 1 + } + return states +} + func (r *Request) WithT(t *testing.T) *Request { return r.WithContext(context.WithValue(r.Context(), tLogKey{}, t.Logf)) } |
