X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=jam.c;h=9eab9c9cfd57d7b0b63859e7c049f016e184e639;hb=HEAD;hp=d0c7923f1688a3f4c328889c9c9d0aac55c53063;hpb=8e6aa84fe8a01bcd49908d78e3310a6697b6294b;p=jam diff --git a/jam.c b/jam.c index d0c7923..9eab9c9 100644 --- a/jam.c +++ b/jam.c @@ -245,6 +245,8 @@ void *sender_worker(void *arg) for ( ;; ) { int num_active = epoll_wait(ep_fd, events, num_sockets_per_sender, -1); if (num_active == -1) { + if (errno == EINTR) + continue; perror("epoll_wait"); exit(1); } @@ -260,7 +262,7 @@ void *sender_worker(void *arg) ret = send(s->fd, buf, bytes_to_send, MSG_NOSIGNAL); if (ret == -1) { - if (errno == EAGAIN) + if (errno == EAGAIN || errno == EINTR) continue; perror("send()"); @@ -334,6 +336,8 @@ void *receiver_worker(void *arg) for ( ;; ) { int num_active = epoll_wait(ep_fd, events, epoll_room_in_receiver, -1); if (num_active == -1) { + if (errno == EINTR) + continue; perror("epoll_wait"); exit(1); } @@ -348,7 +352,7 @@ void *receiver_worker(void *arg) 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 {