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

Fix the ordering of poll callbacks (recv, connect, send)

Because if we have a send event to signal the connection sucess + a recv
event to signal something to read on the socket, we need to first finish the
connect process before reading the available data. That’s what we do now.
parent 4cd97f7e
......@@ -205,15 +205,12 @@ int Poller::poll(const std::chrono::milliseconds& timeout)
for (int i = 0; i < nb_events; ++i)
{
auto socket_handler = static_cast<SocketHandler*>(revents[i].data.ptr);
if (revents[i].events & EPOLLIN)
if (revents[i].events & EPOLLIN && socket_handler->is_connected())
socket_handler->on_recv();
else if (revents[i].events & EPOLLOUT && socket_handler->is_connected())
socket_handler->on_send();
else if (revents[i].events & EPOLLOUT)
{
if (socket_handler->is_connected())
socket_handler->on_send();
else
socket_handler->connect();
}
socket_handler->connect();
}
return nb_events;
#endif
......
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