diff options
Diffstat (limited to 'toxcore/network.c')
-rw-r--r-- | toxcore/network.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/toxcore/network.c b/toxcore/network.c index d974ddc2..b3df3fbd 100644 --- a/toxcore/network.c +++ b/toxcore/network.c | |||
@@ -172,6 +172,17 @@ int set_socket_nosigpipe(sock_t sock) | |||
172 | #endif | 172 | #endif |
173 | } | 173 | } |
174 | 174 | ||
175 | /* Enable SO_REUSEADDR on socket. | ||
176 | * | ||
177 | * return 1 on success | ||
178 | * return 0 on failure | ||
179 | */ | ||
180 | int set_socket_reuseaddr(sock_t sock) | ||
181 | { | ||
182 | int set = 1; | ||
183 | return (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &set, sizeof(set)) == 0); | ||
184 | } | ||
185 | |||
175 | /* Set socket to dual (IPv4 + IPv6 socket) | 186 | /* Set socket to dual (IPv4 + IPv6 socket) |
176 | * | 187 | * |
177 | * return 1 on success | 188 | * return 1 on success |