From 81b2ea4d34a42bee14e1ed17d5166546be957849 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sat, 30 Apr 2016 17:17:26 -0500 Subject: net/http: add Transport.MaxIdleConns limit The HTTP client had a limit for the maximum number of idle connections per-host, but not a global limit. This CLs adds a global idle connection limit too, Transport.MaxIdleConns. All idle conns are now also stored in a doubly-linked list. When there are too many, the oldest one is closed. Fixes #15461 Change-Id: I72abbc28d140c73cf50f278fa70088b45ae0deef Reviewed-on: https://go-review.googlesource.com/22655 Reviewed-by: Andrew Gerrand Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- src/net/http/export_test.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/net/http/export_test.go') diff --git a/src/net/http/export_test.go b/src/net/http/export_test.go index 4c6d9e361f..d1baed896a 100644 --- a/src/net/http/export_test.go +++ b/src/net/http/export_test.go @@ -9,6 +9,7 @@ package http import ( "net" + "sort" "sync" "time" ) @@ -86,6 +87,7 @@ func (t *Transport) IdleConnKeysForTesting() (keys []string) { for key := range t.idleConn { keys = append(keys, key.String()) } + sort.Strings(keys) return } -- cgit v1.3