Test: replace EPOLLIN with blocking sockets + io_uring reads

This commit is contained in:
Vitaliy Filippov
2020-03-01 17:23:14 +03:00
parent 9e18293497
commit d2b37e083a
4 changed files with 43 additions and 39 deletions
+1 -2
View File
@@ -196,7 +196,6 @@ restart:
{
char peer_str[256];
printf("osd: new client %d: connection from %s port %d\n", peer_fd, inet_ntop(AF_INET, &addr.sin_addr, peer_str, 256), ntohs(addr.sin_port));
fcntl(peer_fd, F_SETFL, fcntl(listen_fd, F_GETFL, 0) | O_NONBLOCK);
int one = 1;
setsockopt(peer_fd, SOL_TCP, TCP_NODELAY, &one, sizeof(one));
clients[peer_fd] = {
@@ -208,7 +207,7 @@ restart:
// Add FD to epoll
epoll_event ev;
ev.data.fd = peer_fd;
ev.events = EPOLLIN | EPOLLET | EPOLLRDHUP;
ev.events = EPOLLET | EPOLLRDHUP;
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, peer_fd, &ev) < 0)
{
throw std::runtime_error(std::string("epoll_ctl: ") + strerror(errno));