Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SO_REUSEPORT to econ socket #89

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions src/base/system.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
/* (c) Boris Bobrov, 2019 */
duralakun marked this conversation as resolved.
Show resolved Hide resolved
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
Expand Down Expand Up @@ -912,6 +913,10 @@ static int priv_net_create_socket(int domain, int type, struct sockaddr *addr, i
}
#endif

if (setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, &(int){ 1 }, sizeof(int)) < 0) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this will not work on windows. Maybe i need SO_REUSEADDR...

dbg_msg("net", "failed to setsockopt SO_REUSEPORT");
}

/* bind the socket */
e = bind(sock, addr, sockaddrlen);
if(e != 0)
Expand Down