windows: bump SO_SNDBUF size when playing with >4 players

This commit is contained in:
fgsfds 2021-04-06 18:09:07 +03:00
parent d24798d26f
commit 8c28b0c269
1 changed files with 11 additions and 0 deletions

View File

@ -27,6 +27,17 @@ SOCKET socket_initialize(void) {
return INVALID_SOCKET;
}
#if MAX_PLAYERS > 4
// on windows, the send buffer for the socket needs to be increased
// for the many players case to avoid WSAEWOULDBLOCK on send
// not actually sure this is the "proper" way to fix it
int bufsiz = 128 * 1024; // 128kb, default is apparently 8kb or 16kb
rc = setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (const char *)&bufsiz, sizeof(bufsiz));
if (rc != NO_ERROR) {
LOG_ERROR("setsockopt(SO_SNDBUF) failed with error: %d", rc);
}
#endif
return sock;
}