unix: set SO_REUSEADDR before binding
This commit is contained in:
parent
32b291d5be
commit
b674187c38
@ -334,6 +334,12 @@ static int uv__bind(uv_udp_t* handle,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
yes = 1;
|
||||||
|
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof yes) == -1) {
|
||||||
|
uv__set_sys_error(handle->loop, errno);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (flags & UV_UDP_IPV6ONLY) {
|
if (flags & UV_UDP_IPV6ONLY) {
|
||||||
#ifdef IPV6_V6ONLY
|
#ifdef IPV6_V6ONLY
|
||||||
yes = 1;
|
yes = 1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user