{"action":"closed","issue":{"url":"https://api.github.com/repos/snoyberg/http-client/issues/185","repository_url":"https://api.github.com/repos/snoyberg/http-client","labels_url":"https://api.github.com/repos/snoyberg/http-client/issues/185/labels{/name}","comments_url":"https://api.github.com/repos/snoyberg/http-client/issues/185/comments","events_url":"https://api.github.com/repos/snoyberg/http-client/issues/185/events","html_url":"https://github.com/snoyberg/http-client/issues/185","id":146920340,"number":185,"title":"Incorrect idle connection count in HTTP manager","user":{"login":"nikomi","id":6458404,"avatar_url":"https://avatars.githubusercontent.com/u/6458404?v=3","gravatar_id":"","url":"https://api.github.com/users/nikomi","html_url":"https://github.com/nikomi","followers_url":"https://api.github.com/users/nikomi/followers","following_url":"https://api.github.com/users/nikomi/following{/other_user}","gists_url":"https://api.github.com/users/nikomi/gists{/gist_id}","starred_url":"https://api.github.com/users/nikomi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikomi/subscriptions","organizations_url":"https://api.github.com/users/nikomi/orgs","repos_url":"https://api.github.com/users/nikomi/repos","events_url":"https://api.github.com/users/nikomi/events{/privacy}","received_events_url":"https://api.github.com/users/nikomi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-08T12:45:33Z","updated_at":"2016-04-11T11:24:10Z","closed_at":"2016-04-11T11:24:10Z","body":"Hi,\r\n\r\nI believe the idle connection count is incremented incorrectly in module ```Network.HTTP.Client.Manager``` function ```putSocket``` line 156.\r\n\r\nThe code currently is\r\n```\r\n                let (l', mx) = addToList now (mMaxConns man) ci l\r\n                    cnt' = idleCount + maybe 0 (const 1) mx\r\n                    m' = ManagerOpen cnt' (Map.insert key l' m)\r\n```\r\nSince ```addToList``` returns ```Nothing``` if the connection _was_ added to the idle pool and ```Just ci``` if the connection was _not_ added (and has to be closed) the constants ```0``` and ```1``` should probably be reversed and the line should read:\r\n```\r\n                    cnt' = idleCount + maybe 1 (const 0) mx\r\n```\r\nWhat do you think?\r\n"}}