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.
1 files changed, 4 insertions(+), 7 deletions(-) M louloulibs/network/poller.cpp
M louloulibs/network/poller.cpp => louloulibs/network/poller.cpp +4 -7
@@ 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