*: fix issue found in fast lease renew
parent
575682f593
commit
3839a55910
|
@ -89,6 +89,7 @@ func RenewHTTP(id lease.LeaseID, url string, rt http.RoundTripper, timeout time.
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
b, err := ioutil.ReadAll(resp.Body)
|
b, err := ioutil.ReadAll(resp.Body)
|
||||||
|
resp.Body.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,9 @@ func NewTimeoutTransport(info TLSInfo, dialtimeoutd, rdtimeoutd, wtimeoutd time.
|
||||||
// the timed out connection will timeout soon after it is idle.
|
// 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.
|
// it should not be put back to http transport as an idle connection for future usage.
|
||||||
tr.MaxIdleConnsPerHost = -1
|
tr.MaxIdleConnsPerHost = -1
|
||||||
|
} else {
|
||||||
|
// allow more idle connections between peers to avoid unncessary port allocation.
|
||||||
|
tr.MaxIdleConnsPerHost = 1024
|
||||||
}
|
}
|
||||||
|
|
||||||
tr.Dial = (&rwTimeoutDialer{
|
tr.Dial = (&rwTimeoutDialer{
|
||||||
|
|
Loading…
Reference in New Issue