]> git.sesse.net Git - jam/commitdiff
Handle EAGAIN in connect(). Duh.
authorsgunderson@bigfoot.com <>
Tue, 13 Feb 2007 19:45:27 +0000 (20:45 +0100)
committersgunderson@bigfoot.com <>
Tue, 13 Feb 2007 19:45:27 +0000 (20:45 +0100)
jam.c

diff --git a/jam.c b/jam.c
index f7417e373b5583e852d24b7a7378c9def90f2be3..0353dc53e7c5257d583daee14fa1ef606f674065 100644 (file)
--- a/jam.c
+++ b/jam.c
@@ -10,6 +10,7 @@
 #include <netinet/in.h>
 #include <sys/epoll.h>
 #include <sys/ioctl.h>
+#include <errno.h>
 
 unsigned short port = 2007;
 
@@ -173,7 +174,7 @@ void generate_new_sender(int ep_fd)
        sin.sin_addr = destinations[dst_num];
 
        // non-blocking connect (will be detected by epoll later)
-       if (connect(sock, (struct sockaddr *)&sin, sizeof(sin)) == -1) {
+       if (connect(sock, (struct sockaddr *)&sin, sizeof(sin)) == -1 && errno != EINPROGRESS) {
                perror("connect()");
                exit(1);
        }