summaryrefslogtreecommitdiff
path: root/netlib.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-01-09 11:28:51 -0500
committerEric S. Raymond <esr@thyrsus.com>2013-01-09 11:28:51 -0500
commit061a8a6e99cbbbb858c71cfa847194f72789753e (patch)
tree04b7b9eb5372dce031fd4daa6cadd44c263e6492 /netlib.c
parent58f23f153092c4c928027d53b0e253e8359c5023 (diff)
downloadgpsd-061a8a6e99cbbbb858c71cfa847194f72789753e.tar.gz
Explain some magic.
Diffstat (limited to 'netlib.c')
-rw-r--r--netlib.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/netlib.c b/netlib.c
index 5adc9a89..21bb6dbe 100644
--- a/netlib.c
+++ b/netlib.c
@@ -115,8 +115,15 @@ socket_t netlib_connectsock(int af, const char *host, const char *service,
}
#endif
#ifdef TCP_NODELAY
+ /*
+ * This is a good performance enhancement when the socket is going to
+ * be used to pass a lot of short commands. It prevents them from being
+ * delayed by the Nagle algorithm until they can be aggreagated into
+ * a large packet. See http://en.wikipedia.org/wiki/Nagle%27s_algorithm
+ * for discussion.
+ */
if (type == SOCK_STREAM)
- setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *)&one, sizeof one);
+ setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *)&one, sizeof(one));
#endif
/* set socket to noblocking */