From 3839a55910e6e49fa464b2638a9d7bf8bbf8445e Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Fri, 15 Jul 2016 15:07:15 -0700 Subject: [PATCH] *: fix issue found in fast lease renew --- lease/leasehttp/http.go | 1 + pkg/transport/timeout_transport.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lease/leasehttp/http.go b/lease/leasehttp/http.go index 38590c4f8..cf95595b6 100644 --- a/lease/leasehttp/http.go +++ b/lease/leasehttp/http.go @@ -89,6 +89,7 @@ func RenewHTTP(id lease.LeaseID, url string, rt http.RoundTripper, timeout time. return -1, err } b, err := ioutil.ReadAll(resp.Body) + resp.Body.Close() if err != nil { return -1, err } diff --git a/pkg/transport/timeout_transport.go b/pkg/transport/timeout_transport.go index d59d268fd..742cc5cbf 100644 --- a/pkg/transport/timeout_transport.go +++ b/pkg/transport/timeout_transport.go @@ -34,6 +34,9 @@ func NewTimeoutTransport(info TLSInfo, dialtimeoutd, rdtimeoutd, wtimeoutd time. // the timed out connection will timeout soon after it is idle. // it should not be put back to http transport as an idle connection for future usage. tr.MaxIdleConnsPerHost = -1 + } else { + // allow more idle connections between peers to avoid unncessary port allocation. + tr.MaxIdleConnsPerHost = 1024 } tr.Dial = (&rwTimeoutDialer{