{"action":"created","issue":{"url":"https://api.github.com/repos/karelia/ConnectionKit/issues/88","labels_url":"https://api.github.com/repos/karelia/ConnectionKit/issues/88/labels{/name}","comments_url":"https://api.github.com/repos/karelia/ConnectionKit/issues/88/comments","events_url":"https://api.github.com/repos/karelia/ConnectionKit/issues/88/events","html_url":"https://github.com/karelia/ConnectionKit/pull/88","id":67765454,"number":88,"title":"One CURL session (multi handle) per CK2FileManager","user":{"login":"mikeabdullah","id":165011,"avatar_url":"https://avatars.githubusercontent.com/u/165011?v=3","gravatar_id":"","url":"https://api.github.com/users/mikeabdullah","html_url":"https://github.com/mikeabdullah","followers_url":"https://api.github.com/users/mikeabdullah/followers","following_url":"https://api.github.com/users/mikeabdullah/following{/other_user}","gists_url":"https://api.github.com/users/mikeabdullah/gists{/gist_id}","starred_url":"https://api.github.com/users/mikeabdullah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikeabdullah/subscriptions","organizations_url":"https://api.github.com/users/mikeabdullah/orgs","repos_url":"https://api.github.com/users/mikeabdullah/repos","events_url":"https://api.github.com/users/mikeabdullah/events{/privacy}","received_events_url":"https://api.github.com/users/mikeabdullah/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-11T09:56:30Z","updated_at":"2015-05-15T02:50:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/karelia/ConnectionKit/pulls/88","html_url":"https://github.com/karelia/ConnectionKit/pull/88","diff_url":"https://github.com/karelia/ConnectionKit/pull/88.diff","patch_url":"https://github.com/karelia/ConnectionKit/pull/88.patch"},"body":"Up until now, all `CK2FileManager` instances have shared a single global Curl multi handle, and so have all shared the same connection cache. The trouble is a scenario like so:\r\n\r\n1. Connect to FTP server and do some work\r\n2. Chunk of time elapses (I think at least 5 or 10 minutes)\r\n3. Ask to do more FTP work to the same server\r\n\r\nWe find that the FTP server has quietly shut down our connection (or maybe a router elsewhere on the internet has, don't really know) due to the time elapsed. At least for some connections, libcurl is blissfully unaware of this. So at step 3, it tries to re-use the connection and just sits there until timeout, waiting for something to come back from the server.\r\n\r\nThis pull changes the contract a bit so that it's up to client apps how they want to manage connection re-use. If you do want to re-use connections, simply do all work with the same `CK2FileManager` instance. If you want fresh connections, fire up a fresh file manager and use that.\r\n\r\nWebDAV/HTTP connections still use a global connection cache I believe, because we don't really have control over that. But the OS seems to be able to handle this properly. At some point we'll move to using `NSURLSession` internally, and then will get control over connection re-use, much like the curl-based stuff."},"comment":{"url":"https://api.github.com/repos/karelia/ConnectionKit/issues/comments/102233912","html_url":"https://github.com/karelia/ConnectionKit/pull/88#issuecomment-102233912","issue_url":"https://api.github.com/repos/karelia/ConnectionKit/issues/88","id":102233912,"user":{"login":"terrencetalbot","id":326627,"avatar_url":"https://avatars.githubusercontent.com/u/326627?v=3","gravatar_id":"","url":"https://api.github.com/users/terrencetalbot","html_url":"https://github.com/terrencetalbot","followers_url":"https://api.github.com/users/terrencetalbot/followers","following_url":"https://api.github.com/users/terrencetalbot/following{/other_user}","gists_url":"https://api.github.com/users/terrencetalbot/gists{/gist_id}","starred_url":"https://api.github.com/users/terrencetalbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terrencetalbot/subscriptions","organizations_url":"https://api.github.com/users/terrencetalbot/orgs","repos_url":"https://api.github.com/users/terrencetalbot/repos","events_url":"https://api.github.com/users/terrencetalbot/events{/privacy}","received_events_url":"https://api.github.com/users/terrencetalbot/received_events","type":"User","site_admin":false},"created_at":"2015-05-15T02:50:43Z","updated_at":"2015-05-15T02:50:43Z","body":":+1: , though would be nice to set up testing"}}