mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-16 16:17:38 +03:00
Fixed a bug with improper HostClient map updating in Client.Do. This bug led to new HostClient creation on each Client.Do request
This commit is contained in:
@@ -199,7 +199,7 @@ func (c *Client) Do(req *Request, resp *Response) error {
|
||||
if isTLS {
|
||||
hc.IsTLS = true
|
||||
}
|
||||
m[hc.Addr] = hc
|
||||
m[string(host)] = hc
|
||||
if len(m) == 1 {
|
||||
startCleaner = true
|
||||
}
|
||||
@@ -583,8 +583,9 @@ func (c *HostClient) acquireConn(newConn bool) (*clientConn, error) {
|
||||
createConn := false
|
||||
startCleaner := false
|
||||
|
||||
var n int
|
||||
c.connsLock.Lock()
|
||||
n := len(c.conns)
|
||||
n = len(c.conns)
|
||||
if n == 0 || newConn {
|
||||
maxConns := c.MaxConns
|
||||
if maxConns <= 0 {
|
||||
|
||||
Reference in New Issue
Block a user