{"action":"closed","issue":{"url":"https://api.github.com/repos/mattnenterprise/rust-imap/issues/38","repository_url":"https://api.github.com/repos/mattnenterprise/rust-imap","labels_url":"https://api.github.com/repos/mattnenterprise/rust-imap/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/mattnenterprise/rust-imap/issues/38/comments","events_url":"https://api.github.com/repos/mattnenterprise/rust-imap/issues/38/events","html_url":"https://github.com/mattnenterprise/rust-imap/issues/38","id":259037968,"number":38,"title":"Detect closed connections","user":{"login":"jonhoo","id":176295,"avatar_url":"https://avatars2.githubusercontent.com/u/176295?v=4","gravatar_id":"","url":"https://api.github.com/users/jonhoo","html_url":"https://github.com/jonhoo","followers_url":"https://api.github.com/users/jonhoo/followers","following_url":"https://api.github.com/users/jonhoo/following{/other_user}","gists_url":"https://api.github.com/users/jonhoo/gists{/gist_id}","starred_url":"https://api.github.com/users/jonhoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonhoo/subscriptions","organizations_url":"https://api.github.com/users/jonhoo/orgs","repos_url":"https://api.github.com/users/jonhoo/repos","events_url":"https://api.github.com/users/jonhoo/events{/privacy}","received_events_url":"https://api.github.com/users/jonhoo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-09-20T04:40:36Z","updated_at":"2017-09-27T21:38:52Z","closed_at":"2017-09-27T21:38:52Z","author_association":"CONTRIBUTOR","body":"The current code (in [`Client::readline`](https://github.com/mattnenterprise/rust-imap/blob/master/src/client.rs#L485)) ignores the case when `self.stream.read` returns `Ok(0)`, and simply keeps on spinning. However, when `Ok(0)` is returned, this is a signal that the underlying stream has been closed by the other end (see in particular the openssl error code https://docs.rs/openssl/0.9.17/openssl/ssl/enum.Error.html#variant.ZeroReturn which is translated into `Ok(0)` when using the `Read` trait, the documentation on [`Read::read`](https://doc.rust-lang.org/nightly/std/io/trait.Read.html#tymethod.read), and the manpage for the `recv` system call).\r\n\r\nThe right thing for rust-imap to do is probably to translate this into an error, or alternatively to try and re-establish the connection. It is not entirely clear, but I would guess the former is most appropriate. The infinite spinning it does now certainly isn't :)"}}
{"actor":{"display_login":"mattnenterprise"}}