From 944382a62e47176e44ef35c18440ace180b6d2e1 Mon Sep 17 00:00:00 2001 From: neheb Date: Fri, 17 Feb 2017 16:47:11 -0800 Subject: [PATCH] Add TCP_FASTOPEN support Should make transmission slightly faster. --- libtransmission/net.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libtransmission/net.c b/libtransmission/net.c index b1fbb45cc..ae1faf80f 100644 --- a/libtransmission/net.c +++ b/libtransmission/net.c @@ -384,6 +384,17 @@ tr_netBindTCPImpl (const tr_address * addr, if (!suppressMsgs) tr_logAddDebug ("Bound socket %" PRIdMAX " to port %d on %s", (intmax_t) fd, port, tr_address_to_string (addr)); +#ifdef TCP_FASTOPEN + +#ifndef SOL_TCP +#define SOL_TCP IPPROTO_TCP +#endif + + optval = 5; + setsockopt (fd, SOL_TCP, TCP_FASTOPEN, (const void *) &optval, sizeof (optval)); + +#endif + if (listen (fd, 128) == -1) { *errOut = sockerrno; tr_netCloseSocket (fd);