{"action":"created","issue":{"url":"https://api.github.com/repos/chenshuo/muduo/issues/123","labels_url":"https://api.github.com/repos/chenshuo/muduo/issues/123/labels{/name}","comments_url":"https://api.github.com/repos/chenshuo/muduo/issues/123/comments","events_url":"https://api.github.com/repos/chenshuo/muduo/issues/123/events","html_url":"https://github.com/chenshuo/muduo/pull/123","id":59936487,"number":123,"title":"Enhance the robustness","user":{"login":"weizili","id":8720641,"avatar_url":"https://avatars.githubusercontent.com/u/8720641?v=3","gravatar_id":"","url":"https://api.github.com/users/weizili","html_url":"https://github.com/weizili","followers_url":"https://api.github.com/users/weizili/followers","following_url":"https://api.github.com/users/weizili/following{/other_user}","gists_url":"https://api.github.com/users/weizili/gists{/gist_id}","starred_url":"https://api.github.com/users/weizili/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weizili/subscriptions","organizations_url":"https://api.github.com/users/weizili/orgs","repos_url":"https://api.github.com/users/weizili/repos","events_url":"https://api.github.com/users/weizili/events{/privacy}","received_events_url":"https://api.github.com/users/weizili/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-03-05T11:03:06Z","updated_at":"2015-03-06T05:27:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/chenshuo/muduo/pulls/123","html_url":"https://github.com/chenshuo/muduo/pull/123","diff_url":"https://github.com/chenshuo/muduo/pull/123.diff","patch_url":"https://github.com/chenshuo/muduo/pull/123.patch"},"body":"server端一开始是监听reading事件的，\r\n当应用层读完所有数据的时候，应用层可能会调用 channel->disableReading() \r\nEPollPoller.cc:updateChannel 逻辑会将该 channel->fd_ 从 epoll 中移出。\r\n\r\n当Client端断开连接时，会依次调用 \r\nTcpConnection::handleClose()、channel->disableReading()、EPollPoller.cc:updateChannel等\r\n然而 EPollPoller.cc:updateChannel 这里的状态机不满足这种调用场景，又会将该 channel::fd_ 放入 epoll 中，\r\n这样会造成不必要的系统调用，同时状态也更复杂。\r\n\r\n因此做一个基本的检查，如果没有事件要监听的话，就不添加到epoll中。\r\n"},"comment":{"url":"https://api.github.com/repos/chenshuo/muduo/issues/comments/77508877","html_url":"https://github.com/chenshuo/muduo/pull/123#issuecomment-77508877","issue_url":"https://api.github.com/repos/chenshuo/muduo/issues/123","id":77508877,"user":{"login":"zieckey","id":1480726,"avatar_url":"https://avatars.githubusercontent.com/u/1480726?v=3","gravatar_id":"","url":"https://api.github.com/users/zieckey","html_url":"https://github.com/zieckey","followers_url":"https://api.github.com/users/zieckey/followers","following_url":"https://api.github.com/users/zieckey/following{/other_user}","gists_url":"https://api.github.com/users/zieckey/gists{/gist_id}","starred_url":"https://api.github.com/users/zieckey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zieckey/subscriptions","organizations_url":"https://api.github.com/users/zieckey/orgs","repos_url":"https://api.github.com/users/zieckey/repos","events_url":"https://api.github.com/users/zieckey/events{/privacy}","received_events_url":"https://api.github.com/users/zieckey/received_events","type":"User","site_admin":false},"created_at":"2015-03-06T05:27:55Z","updated_at":"2015-03-06T05:27:55Z","body":"假如我们用Channel自己封装一个第三方库，有可能就会用到，例如：\r\nexamples/hiredis/Hiredis.cc:181:  hiredis->channel_->disableReading();"}}