mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -05:00
non-blocking setting on win32 broke with previous patch. Add optional xml setting for
specifying the TCP send buffer size, it seems that on at least some win32 systems, the window size stays at 8k (even with registry settings) which could limit available streaming bandwidth. svn path=/icecast/trunk/icecast/; revision=15766
This commit is contained in:
parent
1ab9b4a887
commit
d784622396
@ -821,6 +821,11 @@ static void _parse_listen_socket(xmlDocPtr doc, xmlNodePtr node,
|
||||
listener->bind_address = (char *)xmlNodeListGetString(doc,
|
||||
node->xmlChildrenNode, 1);
|
||||
}
|
||||
else if (xmlStrcmp (node->name, XMLSTR("so-sndbuf")) == 0) {
|
||||
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
||||
listener->so_sndbuf = atoi(tmp);
|
||||
if(tmp) xmlFree(tmp);
|
||||
}
|
||||
} while ((node = node->next));
|
||||
|
||||
/* we know there's at least one of these, so add this new one after the first
|
||||
|
@ -101,6 +101,7 @@ typedef struct _aliases {
|
||||
typedef struct _listener_t {
|
||||
struct _listener_t *next;
|
||||
int port;
|
||||
int so_sndbuf;
|
||||
char *bind_address;
|
||||
int shoutcast_compat;
|
||||
char *shoutcast_mount;
|
||||
|
@ -1404,6 +1404,9 @@ int connection_setup_sockets (ice_config_t *config)
|
||||
sock_close (sock);
|
||||
break;
|
||||
}
|
||||
/* some win32 setups do not do TCP win scaling well, so allow an override */
|
||||
if (listener->so_sndbuf)
|
||||
sock_set_send_buffer (sock, listener->so_sndbuf);
|
||||
sock_set_blocking (sock, 0);
|
||||
successful = 1;
|
||||
global.serversock [count] = sock;
|
||||
|
@ -217,7 +217,7 @@ int sock_active (sock_t sock)
|
||||
l = recv (sock, &c, 1, MSG_PEEK);
|
||||
if (l == 0)
|
||||
return 0;
|
||||
if (l < 0 && sock_recoverable (sock_error()))
|
||||
if (l == SOCK_ERROR && sock_recoverable (sock_error()))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
@ -251,9 +251,9 @@ int sock_set_blocking(sock_t sock, int block)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#ifdef __MINGW32__
|
||||
u_long varblock = block;
|
||||
u_long varblock = 1;
|
||||
#else
|
||||
int varblock = block;
|
||||
int varblock = 1;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -261,6 +261,7 @@ int sock_set_blocking(sock_t sock, int block)
|
||||
return SOCK_ERROR;
|
||||
|
||||
#ifdef _WIN32
|
||||
if (block) varblock = 0;
|
||||
return ioctlsocket(sock, FIONBIO, &varblock);
|
||||
#else
|
||||
return fcntl(sock, F_SETFL, (block) ? 0 : O_NONBLOCK);
|
||||
@ -892,6 +893,11 @@ sock_t sock_get_server_socket(int port, const char *sinterface)
|
||||
|
||||
#endif
|
||||
|
||||
void sock_set_send_buffer (sock_t sock, int win_size)
|
||||
{
|
||||
setsockopt (sock, SOL_SOCKET, SO_SNDBUF, (char *) &win_size, sizeof(win_size));
|
||||
}
|
||||
|
||||
int sock_listen(sock_t serversock, int backlog)
|
||||
{
|
||||
if (!sock_valid_socket(serversock))
|
||||
|
@ -95,6 +95,7 @@ struct iovec
|
||||
# define sock_read_line _mangle(sock_read_line)
|
||||
# define sock_get_server_socket _mangle(sock_get_server_socket)
|
||||
# define sock_listen _mangle(sock_listen)
|
||||
# define sock_set_send_buffer _mangle(sock_set_send_buffer)
|
||||
# define sock_accept _mangle(sock_accept)
|
||||
#endif
|
||||
|
||||
@ -107,10 +108,11 @@ int sock_recoverable(int error);
|
||||
int sock_stalled(int error);
|
||||
int sock_valid_socket(sock_t sock);
|
||||
int sock_active (sock_t sock);
|
||||
int sock_set_blocking(sock_t sock, const int block);
|
||||
int sock_set_blocking(sock_t sock, int block);
|
||||
int sock_set_nolinger(sock_t sock);
|
||||
int sock_set_keepalive(sock_t sock);
|
||||
int sock_set_nodelay(sock_t sock);
|
||||
void sock_set_send_buffer (sock_t sock, int win_size);
|
||||
void sock_set_error(int val);
|
||||
int sock_close(sock_t sock);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user