1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

Fix: Avoid breaking windows port

Windows understands FD_SETSIZE as POSIX does but unlike Linux (and likely
*BSD) does. While Linux uses the value to mark the highest value of a
filehandle, Windows understands it as the number of handles.
This commit is contained in:
Philipp Schafft 2023-06-11 20:10:04 +00:00
parent 2357cca098
commit 86635ee700
3 changed files with 3 additions and 3 deletions

View File

@ -1053,7 +1053,7 @@ int config_parse_file(const char *filename, ice_config_t *configuration)
ICECAST_LOG_ERROR("Client limit (%i) is too small for given source limit (%i)", configuration->client_limit, configuration->source_limit);
}
#ifndef HAVE_POLL
#if !defined(HAVE_POLL) && !defined(_WIN32)
if (configuration->client_limit > (FD_SETSIZE - 32)) {
configuration->config_problems |= CONFIG_PROBLEM_VALIDATION;
ICECAST_LOG_ERROR("Client limit (%i) is too big for FD_SETSIZE (%i)", configuration->client_limit, FD_SETSIZE);

View File

@ -471,7 +471,7 @@ connection_t *connection_create(sock_t sock, listensocket_t *listensocket_real,
if (!matchfile_match_allow_deny(allowed_ip, banned_ip, ip))
return NULL;
#ifndef HAVE_POLL
#if !defined(HAVE_POLL) && !defined(_WIN32)
if (sock >= FD_SETSIZE) {
ICECAST_LOG_ERROR("Can not create connection: System filehandle set overflow");
return NULL;

View File

@ -726,7 +726,7 @@ static int listensocket_refsock(listensocket_t *self, bool prefer_inet6)
return -1;
}
#ifndef HAVE_POLL
#if !defined(HAVE_POLL) && !defined(_WIN32)
if (self->sock >= FD_SETSIZE) {
sock_close(self->sock);
self->sock = SOCK_ERROR;