]> git.sesse.net Git - jam/blobdiff - jam.c
EINTR, not EAGAIN.
[jam] / jam.c
diff --git a/jam.c b/jam.c
index d0c7923f1688a3f4c328889c9c9d0aac55c53063..9eab9c9cfd57d7b0b63859e7c049f016e184e639 100644 (file)
--- 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 {