for ( ;; ) {
int num_active = epoll_wait(ep_fd, events, num_sockets_per_sender, -1);
if (num_active == -1) {
- if (errno == EAGAIN)
+ if (errno == EINTR)
continue;
perror("epoll_wait");
exit(1);
ret = send(s->fd, buf, bytes_to_send, MSG_NOSIGNAL);
if (ret == -1) {
- if (errno == EAGAIN)
+ if (errno == EAGAIN || errno == EINTR)
continue;
perror("send()");
for ( ;; ) {
int num_active = epoll_wait(ep_fd, events, epoll_room_in_receiver, -1);
if (num_active == -1) {
- if (errno == EAGAIN)
+ if (errno == EINTR)
continue;
perror("epoll_wait");
exit(1);
sock = accept(server_sock, (struct sockaddr *)&addr, &addr_len);
if (sock == -1) {
- if (errno == EAGAIN) {
+ if (errno == EAGAIN || errno == EINTR) {
// another thread snatched it, ignore
continue;
} else {