From: Egor Date: Tue, 17 May 2022 16:13:30 +0000 (+0300) Subject: only do SO_REUSEADDR on unix X-Git-Url: https://git.patchysicp.xyz/?a=commitdiff_plain;h=2dd13930ea23d7e641d1818594474ebe19937789;p=patchyircd.git only do SO_REUSEADDR on unix on windows it acts more like SO_REUSEPORT --- diff --git a/main.c b/main.c index 9f036bd..df688ee 100644 --- 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) {