Commit 22018837 authored by Michael Smith's avatar Michael Smith

Set TCP_NODELAY on sockets for streams and fileserving.

Adapted from a patch sent by Richard Galli

svn path=/trunk/net/; revision=4260
parent 264783fb
......@@ -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 */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment