Fix SO_REUSEPORT issue in linux.

This commit is contained in:
Curtis Yarvin 2013-10-31 17:20:42 +00:00
parent ffe0786f03
commit 91adaea16a
2 changed files with 4 additions and 2 deletions

View File

@ -335,12 +335,14 @@ static int uv__bind(uv_udp_t* handle,
* None of the above applies to Linux: SO_REUSEADDR implies SO_REUSEPORT on
* Linux and hence it does not have SO_REUSEPORT at all.
*/
#ifndef __linux__
#ifdef SO_REUSEPORT
yes = 1;
if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof yes) == -1) {
uv__set_sys_error(handle->loop, errno);
goto out;
}
#endif
#endif
if (flags & UV_UDP_IPV6ONLY) {

View File

@ -298,7 +298,7 @@ u2_ames_io_init()
u2z(num);
}
if ( 0 != uv_udp_init(u2L, &sam_u->wax_u) ) {
if ( 0 != uv_udp_init(u2L, &u2_Host.sam_u.wax_u) ) {
uL(fprintf(uH, "ames: init: %s\n", uv_strerror(uv_last_error(u2L))));
c3_assert(0);
}
@ -314,7 +314,7 @@ u2_ames_io_init()
add_u.sin_port = htons(por_s);
if ( uv_udp_bind(&sam_u->wax_u, add_u, 0) != 0 ) {
uL(fprintf(uH, "ames: init: %s\n",
uL(fprintf(uH, "ames: bind: %s\n",
uv_strerror(uv_last_error(u2L))));
c3_assert(0);
}