mirror of
https://gitlab.xiph.org/xiph/icecast-common.git
synced 2024-11-03 04:17:20 -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/net/; revision=15766
This commit is contained in:
parent
3937e807fe
commit
65eb342fd8
12
net/sock.c
12
net/sock.c
@ -217,7 +217,7 @@ int sock_active (sock_t sock)
|
|||||||
l = recv (sock, &c, 1, MSG_PEEK);
|
l = recv (sock, &c, 1, MSG_PEEK);
|
||||||
if (l == 0)
|
if (l == 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (l < 0 && sock_recoverable (sock_error()))
|
if (l == SOCK_ERROR && sock_recoverable (sock_error()))
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -251,9 +251,9 @@ int sock_set_blocking(sock_t sock, int block)
|
|||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
u_long varblock = block;
|
u_long varblock = 1;
|
||||||
#else
|
#else
|
||||||
int varblock = block;
|
int varblock = 1;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -261,6 +261,7 @@ int sock_set_blocking(sock_t sock, int block)
|
|||||||
return SOCK_ERROR;
|
return SOCK_ERROR;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
if (block) varblock = 0;
|
||||||
return ioctlsocket(sock, FIONBIO, &varblock);
|
return ioctlsocket(sock, FIONBIO, &varblock);
|
||||||
#else
|
#else
|
||||||
return fcntl(sock, F_SETFL, (block) ? 0 : O_NONBLOCK);
|
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
|
#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)
|
int sock_listen(sock_t serversock, int backlog)
|
||||||
{
|
{
|
||||||
if (!sock_valid_socket(serversock))
|
if (!sock_valid_socket(serversock))
|
||||||
|
@ -95,6 +95,7 @@ struct iovec
|
|||||||
# define sock_read_line _mangle(sock_read_line)
|
# define sock_read_line _mangle(sock_read_line)
|
||||||
# define sock_get_server_socket _mangle(sock_get_server_socket)
|
# define sock_get_server_socket _mangle(sock_get_server_socket)
|
||||||
# define sock_listen _mangle(sock_listen)
|
# define sock_listen _mangle(sock_listen)
|
||||||
|
# define sock_set_send_buffer _mangle(sock_set_send_buffer)
|
||||||
# define sock_accept _mangle(sock_accept)
|
# define sock_accept _mangle(sock_accept)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -107,10 +108,11 @@ int sock_recoverable(int error);
|
|||||||
int sock_stalled(int error);
|
int sock_stalled(int error);
|
||||||
int sock_valid_socket(sock_t sock);
|
int sock_valid_socket(sock_t sock);
|
||||||
int sock_active (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_nolinger(sock_t sock);
|
||||||
int sock_set_keepalive(sock_t sock);
|
int sock_set_keepalive(sock_t sock);
|
||||||
int sock_set_nodelay(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);
|
void sock_set_error(int val);
|
||||||
int sock_close(sock_t sock);
|
int sock_close(sock_t sock);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user