]> git.sesse.net Git - jam/blobdiff - jam.c
Minor epoll fixes.
[jam] / jam.c
diff --git a/jam.c b/jam.c
index c1f9bb17adc729cca87bcbaef4cc82ff4d767432..0141e5ba45398df0f8cac42559eca84e85b166ae 100644 (file)
--- a/jam.c
+++ b/jam.c
@@ -278,7 +278,7 @@ void *sender_worker(void *arg)
                        
                        if (s->bytes_left == 0) {
                                if (epoll_ctl(ep_fd, EPOLL_CTL_DEL, s->fd, NULL) == -1) {
-                                       perror("EPOLL_CTL_ADD");
+                                       perror("EPOLL_CTL_DEL");
                                        exit(1);
                                }
                                close(s->fd);
@@ -366,13 +366,11 @@ void *receiver_worker(void *arg)
 
                        ret = read(sock, buf, 65536);
                        if (ret == 0) {
-                               close(sock);
-                               
                                if (epoll_ctl(ep_fd, EPOLL_CTL_DEL, sock, NULL) == -1) {
-                                       perror("EPOLL_CTL_ADD");
+                                       perror("EPOLL_CTL_DEL");
                                        exit(1);
                                }
-
+                               close(sock);
                                continue;
                        }