[6.0] 04ae469a7 vca: Give all const socket options placeholers

Martin Blix Grydeland martin at varnish-software.com
Fri Nov 19 14:58:11 UTC 2021


commit 04ae469a7f656f011aba790af3018424c745ad46
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Sep 27 12:42:54 2021 +0200

    vca: Give all const socket options placeholers
    
    The SO_KEEPALIVE justification used to precede such a constant and was
    left confusingly lingering over the unrelated need_test variable.

diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c
index 29128e581..c141c9189 100644
--- a/bin/varnishd/cache/cache_acceptor.c
+++ b/bin/varnishd/cache/cache_acceptor.c
@@ -130,6 +130,13 @@ static const struct linger linger = {
  * hung up on connections returning from waitinglists
  */
 
+static const unsigned so_keepalive = 1;
+
+/* We disable Nagle's algorithm in favor of low latency setups.
+ */
+
+static const unsigned tcp_nodelay = 1;
+
 static unsigned		need_test;
 
 /*--------------------------------------------------------------------
@@ -190,13 +197,13 @@ vca_sock_opt_init(void)
 	} while (0)
 
 		SET_VAL(SO_LINGER, so, lg, linger);
-		SET_VAL(SO_KEEPALIVE, so, i, 1);
+		SET_VAL(SO_KEEPALIVE, so, i, so_keepalive);
 		NEW_VAL(SO_SNDTIMEO, so, tv,
 		    VTIM_timeval(cache_param->idle_send_timeout));
 		NEW_VAL(SO_RCVTIMEO, so, tv,
 		    VTIM_timeval(cache_param->timeout_idle));
+		SET_VAL(TCP_NODELAY, so, i, tcp_nodelay);
 #ifdef HAVE_TCP_KEEP
-		SET_VAL(TCP_NODELAY, so, i, 1);
 		NEW_VAL(TCP_KEEPIDLE, so, i,
 		    (int)cache_param->tcp_keepalive_time);
 		NEW_VAL(TCP_KEEPCNT, so, i,


More information about the varnish-commit mailing list