1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-06-23 06:25:24 +00:00

Set TCP_NODELAY on sockets for streams and fileserving.

Adapted from a patch sent by Richard Galli

svn path=/trunk/icecast/; revision=4260
This commit is contained in:
Michael Smith 2003-01-18 07:08:00 +00:00
parent 369a4568b6
commit f2d0e26fed
4 changed files with 12 additions and 0 deletions

View File

@ -770,6 +770,7 @@ static void _handle_get_request(connection_t *con,
if(bytes > 0) client->con->sent_bytes += bytes;
sock_set_blocking(client->con->sock, SOCK_NONBLOCK);
sock_set_nodelay(client->con->sock);
avl_tree_wlock(source->pending_tree);
avl_insert(source->pending_tree, (void *)client);

View File

@ -380,6 +380,7 @@ int fserve_client_create(client_t *httpclient, char *path)
if(bytes > 0) httpclient->con->sent_bytes = bytes;
sock_set_blocking(client->client->con->sock, SOCK_NONBLOCK);
sock_set_nodelay(client->client->con->sock);
avl_tree_wlock(pending_tree);
avl_insert(pending_tree, client);

View File

@ -32,6 +32,7 @@
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <sys/time.h>
#include <netdb.h>
@ -200,6 +201,14 @@ int sock_set_nolinger(sock_t sock)
sizeof(struct linger));
}
int sock_set_nodelay(sock_t sock)
{
int nodelay = 1;
return setsockopt(sock, SOL_TCP, TCP_NODELAY, (void *)nodelay,
sizeof(int));
}
int sock_set_keepalive(sock_t sock)
{
int keepalive = 1;

View File

@ -66,6 +66,7 @@ int sock_valid_socket(sock_t sock);
int sock_set_blocking(sock_t sock, const int block);
int sock_set_nolinger(sock_t sock);
int sock_set_keepalive(sock_t sock);
int sock_set_nodelay(sock_t sock);
int sock_close(sock_t sock);
/* Connection related socket functions */