mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-28 21:07:59 +03:00
fix(socket): do not reuse port
This commit is contained in:
@@ -9,8 +9,7 @@ Socket::Socket(int domain, int type, int protocol, int port, std::string ip)
|
|||||||
int opt = 1;
|
int opt = 1;
|
||||||
_socketFd = socket(domain, type, protocol);
|
_socketFd = socket(domain, type, protocol);
|
||||||
checkError(_socketFd, "Initialize Server socket");
|
checkError(_socketFd, "Initialize Server socket");
|
||||||
checkError(setsockopt(_socketFd, SOL_SOCKET, SO_REUSEADDR
|
checkError(setsockopt(_socketFd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)), "Set socket options");
|
||||||
| SO_REUSEPORT, &opt, sizeof(opt)), "Set socket options");
|
|
||||||
_addres.sin_family = domain;
|
_addres.sin_family = domain;
|
||||||
_addres.sin_port = htons(port);
|
_addres.sin_port = htons(port);
|
||||||
_addres.sin_addr.s_addr = inet_addr(ip.c_str());
|
_addres.sin_addr.s_addr = inet_addr(ip.c_str());
|
||||||
|
|||||||
Reference in New Issue
Block a user