Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Network/GlobalHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ SOCKET SetupListener() {
WSACleanup();
return -1;
}
#ifdef __linux__
// On linux the old socket can get stuck in time wait
const int reuse_addr = 1;
if (setsockopt(GSocket, SOL_SOCKET, SO_REUSEADDR, &reuse_addr, sizeof(int)) < 0) {
warn("(Proxy) setsockopt(SO_REUSEADDR) failed" + std::to_string(WSAGetLastError()));
}
#endif
iRes = bind(GSocket, result->ai_addr, (int)result->ai_addrlen);
if (iRes == SOCKET_ERROR) {
error("(Proxy) bind failed with error: " + std::to_string(WSAGetLastError()));
Expand Down
Loading