[master] 7e20f094e vca: Give all const socket options placeholers

Nils Goroll nils.goroll at uplex.de
Wed Nov 17 11:07:07 UTC 2021


commit 7e20f094ec317c8aae11b4b4ed3d0a3c370447dc
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 73a341f07..bd27ffd65 100644
--- a/bin/varnishd/cache/cache_acceptor.c
+++ b/bin/varnishd/cache/cache_acceptor.c
@@ -129,6 +129,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;
 
 /*--------------------------------------------------------------------
@@ -189,13 +196,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