Use EPOLLET

Its latency is slightly better, too
This commit is contained in:
Vitaliy Filippov
2020-02-29 01:56:59 +03:00
parent c41fd7ea18
commit fd05e13bc4
4 changed files with 44 additions and 45 deletions
+9 -8
View File
@@ -33,8 +33,6 @@ void osd_t::read_requests()
cl.read_msg.msg_iovlen = 1;
data->callback = [this, peer_fd](ring_data_t *data) { handle_read(data, peer_fd); };
my_uring_prep_recvmsg(sqe, peer_fd, &cl.read_msg, 0);
cl.reading = true;
cl.read_ready = false;
}
read_ready_clients.clear();
}
@@ -45,18 +43,21 @@ void osd_t::handle_read(ring_data_t *data, int peer_fd)
if (cl_it != clients.end())
{
auto & cl = cl_it->second;
if (data->res < 0 && data->res != -EAGAIN)
if (data->res == -EAGAIN)
{
cl.read_ready--;
if (cl.read_ready > 0)
read_ready_clients.push_back(peer_fd);
return;
}
else if (data->res < 0)
{
// this is a client socket, so don't panic. just disconnect it
printf("Client %d socket read error: %d (%s). Disconnecting client\n", peer_fd, -data->res, strerror(-data->res));
stop_client(peer_fd);
return;
}
cl.reading = false;
if (cl.read_ready)
{
read_ready_clients.push_back(peer_fd);
}
read_ready_clients.push_back(peer_fd);
if (data->res > 0)
{
cl.read_remaining -= data->res;