Fix Client ms cleaner (#975)

* Improve documentation about DelClientCookie which related with #951.

* Fix ms cleaner in Client
This commit is contained in:
kiyon
2021-02-23 03:19:50 +08:00
committed by GitHub
parent 3cd0862fbb
commit 62dfc528ef
+3 -3
View File
@@ -512,7 +512,7 @@ func (c *Client) Do(req *Request, resp *Response) error {
c.mLock.Unlock()
if startCleaner {
go c.mCleaner()
go c.mCleaner(m)
}
return hc.Do(req, resp)
@@ -533,12 +533,12 @@ func (c *Client) CloseIdleConnections() {
c.mLock.Unlock()
}
func (c *Client) mCleaner() {
func (c *Client) mCleaner(m map[string]*HostClient) {
mustStop := false
for {
c.mLock.Lock()
for k, v := range c.m {
for k, v := range m {
v.connsLock.Lock()
shouldRemove := v.connsCount == 0
v.connsLock.Unlock()