Commit 6b0ffb5f authored by louiz’'s avatar louiz’

If both write and read events are available on a socket, only do the read

Because the read handler may discover that the connection has been closed,
and then remove the socket from the poller. It that case it is no longer
valid to try to call the write handler (which may try to reconnect, but
since that socket is no longer managed, this is not OK).
parent 7fb0b671
......@@ -185,7 +185,7 @@ int Poller::poll(const std::chrono::milliseconds& timeout)
auto socket_handler = static_cast<SocketHandler*>(revents[i].data.ptr);
if (revents[i].events & EPOLLIN)
socket_handler->on_recv();
if (revents[i].events & EPOLLOUT)
else if (revents[i].events & EPOLLOUT)
{
if (socket_handler->is_connected())
socket_handler->on_send();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment