summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelupus <elupus@ecce.se>2009-05-26 16:14:48 +0200
committerJulien Danjou <julien@danjou.info>2009-05-26 16:14:48 +0200
commitee89850e68205a7f8961ace0839b5be86040dade (patch)
tree9d5e082b0bf36d4195df53cfa517b20a9933ac91
parent62fe187e2d617eb0feb1ca03d8b4a64db9dd952b (diff)
Disable Nagle on TCP socket
Signed-off-by: Julien Danjou <julien@danjou.info>
-rw-r--r--src/xcb_util.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/xcb_util.c b/src/xcb_util.c
index adac909..55aadb7 100644
--- a/src/xcb_util.c
+++ b/src/xcb_util.c
@@ -30,6 +30,7 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
+#include <netinet/tcp.h>
#ifdef DNETCONN
#include <netdnet/dnetdb.h>
#include <netdnet/dn.h>
@@ -257,6 +258,9 @@ static int _xcb_open_tcp(char *host, char *protocol, const unsigned short port)
{
fd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
if(fd >= 0) {
+ int on = 1;
+ setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
+
if (connect(fd, addr->ai_addr, addr->ai_addrlen) >= 0)
break;
close(fd);