]> PatchyGit - patchyircd.git/commitdiff
only do SO_REUSEADDR on unix
authorEgor <egor@patchysicp.xyz>
Tue, 17 May 2022 16:13:30 +0000 (19:13 +0300)
committerEgor <egor@patchysicp.xyz>
Tue, 17 May 2022 16:13:30 +0000 (19:13 +0300)
on windows it acts more like SO_REUSEPORT

main.c

diff --git a/main.c b/main.c
index 9f036bd..df688ee 100644 (file)
--- a/main.c
+++ b/main.c
@@ -93,10 +93,12 @@ SOCKET create_listen_sock(int af, struct sockaddr *addr, size_t len)
        }
        // Set socket options
        int opt = 1;
+#ifndef _WIN32
        if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*)&opt, sizeof(opt)) == -1) {
                net_perror("ERROR SOCKET");
                exit(EXIT_FAILURE);
        }
+#endif
 #ifdef SUPPORT_IPV6
        // IPV6 Only
        if(af == AF_INET6 && setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (void*)&opt, sizeof(opt)) == -1) {