mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-02 03:06:40 +00:00
Patch for Node.js -- accept() bug
This commit is contained in:
parent
d472c59b8d
commit
3d163f7044
@ -25,7 +25,6 @@
|
|||||||
* LLC. Start here: http://www.zerotier.com/
|
* LLC. Start here: http://www.zerotier.com/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_GNU_SOURCE
|
#ifdef USE_GNU_SOURCE
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#endif
|
#endif
|
||||||
@ -834,10 +833,10 @@ int accept(ACCEPT_SIG)
|
|||||||
handle_error("accept", "Unresolved symbol [accept]", -1);
|
handle_error("accept", "Unresolved symbol [accept]", -1);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if(opt & O_NONBLOCK)
|
// if(opt & O_NONBLOCK)
|
||||||
fcntl(sockfd, F_SETFL, O_NONBLOCK);
|
fcntl(sockfd, F_SETFL, O_NONBLOCK); /* required by libuv in nodejs */
|
||||||
*/
|
|
||||||
|
|
||||||
char c[1];
|
char c[1];
|
||||||
int new_conn_socket;
|
int new_conn_socket;
|
||||||
@ -874,9 +873,17 @@ int accept(ACCEPT_SIG)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
errno = EAGAIN; /* necessary? */
|
||||||
|
handle_error("accept", "EAGAIN - Error reading signal byte from service", -1);
|
||||||
|
return -EAGAIN;
|
||||||
|
|
||||||
|
/* Prevents libuv in nodejs from accepting properly (it looks for a -EAGAIN) */
|
||||||
|
/*
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
handle_error("accept", "EBADF - Error reading signal byte from service", -1);
|
handle_error("accept", "EBADF - Error reading signal byte from service", -1);
|
||||||
return -1;
|
return -1;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1080,12 +1087,10 @@ long syscall(SYSCALL_SIG){
|
|||||||
int flags = d;
|
int flags = d;
|
||||||
int old_errno = errno;
|
int old_errno = errno;
|
||||||
int err = accept4(sockfd, addr, addrlen, flags);
|
int err = accept4(sockfd, addr, addrlen, flags);
|
||||||
|
|
||||||
errno = old_errno;
|
errno = old_errno;
|
||||||
|
if(err == -EBADF)
|
||||||
if(err == -EBADF) {
|
err = -EAGAIN;
|
||||||
err = -EAGAIN; /* For hysterical raisins */
|
|
||||||
}
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user