socket: Set SO_REUSEPORT before bind()

bind() fails if it is called before setting SO_REUSEPORT and another
process is already binded to the same addess.

A new reuse_port option has been introduced to socket_address_listen()
to set the option as part of socket initialization.
This commit is contained in:
Christos Trochalakis
2015-07-01 16:43:03 +03:00
parent 52a321d839
commit 54255c64e6
3 changed files with 10 additions and 7 deletions
+1
View File
@@ -80,6 +80,7 @@ int socket_address_listen(
int backlog,
SocketAddressBindIPv6Only only,
const char *bind_to_device,
bool reuse_port,
bool free_bind,
bool transparent,
mode_t directory_mode,