summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2011-10-26 16:02:06 +0000
committerMatt Johnston <matt@ucc.asn.au>2011-10-26 16:02:06 +0000
commit1119ad3a2fc0a504a3e17b5aa6439f8553aa2848 (patch)
treec2a1d2e509bce7dbd44d4ac6711e22e06ddd97e9
parent29e68e9d79dd41e9be0d1d731e132355d1ea8ba6 (diff)
Set IPTOS_LOWDELAY for IPv6 too
--HG-- extra : convert_revision : bebc84493fc5f4ca914ae8828e6db7204c086ac2
-rw-r--r--dbutil.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/dbutil.c b/dbutil.c
index abbd040..39804ce 100644
--- a/dbutil.c
+++ b/dbutil.c
@@ -161,10 +161,12 @@ static void set_sock_priority(int sock) {
val = 1;
setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void*)&val, sizeof(val));
- /* set the TOS bit. note that this will fail for ipv6, I can't find any
- * equivalent. */
+ /* set the TOS bit for either ipv4 or ipv6 */
#ifdef IPTOS_LOWDELAY
val = IPTOS_LOWDELAY;
+#ifdef IPPROTO_IPV6
+ setsockopt(sock, IPPROTO_IPV6, IPV6_TCLASS, (void*)&val, sizeof(val));
+#endif
setsockopt(sock, IPPROTO_IP, IP_TOS, (void*)&val, sizeof(val));
#endif