From de10ccd97b789be670eae97d6d751b1cea33fcae Mon Sep 17 00:00:00 2001 From: Green Sky Date: Sun, 10 Nov 2024 17:13:22 +0100 Subject: [PATCH] fix: windows use of REUSEADDR --- toxcore/network.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/toxcore/network.c b/toxcore/network.c index 55aa4e2818..da853d212b 100644 --- a/toxcore/network.c +++ b/toxcore/network.c @@ -882,7 +882,11 @@ bool set_socket_nosigpipe(const Network *ns, Socket sock) bool set_socket_reuseaddr(const Network *ns, Socket sock) { int set = 1; +#if defined(OS_WIN32) + return net_setsockopt(ns, sock, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, &set, sizeof(set)) == 0; +#else return net_setsockopt(ns, sock, SOL_SOCKET, SO_REUSEADDR, &set, sizeof(set)) == 0; +#endif /* OS_WIN32 */ } bool set_socket_dualstack(const Network *ns, Socket sock)