Skip to content

Commit

Permalink
Fix Client ms cleaner (#975)
Browse files Browse the repository at this point in the history
* Improve documentation about DelClientCookie which related with #951.

* Fix ms cleaner in Client
  • Loading branch information
kiyonlin authored Feb 22, 2021
1 parent 3cd0862 commit 62dfc52
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down

0 comments on commit 62dfc52

Please sign in to comment.