mirror of
https://gitlab.xiph.org/xiph/icecast-common.git
synced 2025-02-02 15:07:47 -05:00
Set TCP_NODELAY on sockets for streams and fileserving.
Adapted from a patch sent by Richard Galli svn path=/trunk/net/; revision=4260
This commit is contained in:
parent
38a1834bd6
commit
6bc46604b9
@ -32,6 +32,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
@ -200,6 +201,14 @@ int sock_set_nolinger(sock_t sock)
|
|||||||
sizeof(struct linger));
|
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 sock_set_keepalive(sock_t sock)
|
||||||
{
|
{
|
||||||
int keepalive = 1;
|
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_blocking(sock_t sock, const 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_close(sock_t sock);
|
int sock_close(sock_t sock);
|
||||||
|
|
||||||
/* Connection related socket functions */
|
/* Connection related socket functions */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user