mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05: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:
parent
369a4568b6
commit
f2d0e26fed
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user