Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
unix: set SO_REUSEADDR before binding
Browse files Browse the repository at this point in the history
  • Loading branch information
wankdanker authored and bnoordhuis committed Jan 21, 2012
1 parent 32b291d commit b674187
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/unix/udp.c
Expand Up @@ -334,6 +334,12 @@ static int uv__bind(uv_udp_t* handle,
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) {
#ifdef IPV6_V6ONLY
yes = 1;
Expand Down

0 comments on commit b674187

Please sign in to comment.