[master] 439f2619e vca: Give all const socket options placeholers

Nils Goroll nils.goroll at uplex.de
Tue Nov 23 12:31:11 UTC 2021


commit 439f2619ee996506a7c4d1ee5c3eda1f99884cb5
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.
    
    Conflicts:
            bin/varnishd/cache/cache_acceptor.c

diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c
index 9d1250412..9df90387b 100644
--- a/bin/varnishd/cache/cache_acceptor.c
+++ b/bin/varnishd/cache/cache_acceptor.c
@@ -132,6 +132,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;
 
 /*--------------------------------------------------------------------
@@ -192,7 +199,7 @@ 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);
 #ifdef SO_SNDTIMEO_WORKS
 		NEW_VAL(SO_SNDTIMEO, so, tv,
 		    VTIM_timeval(cache_param->idle_send_timeout));
@@ -201,8 +208,8 @@ vca_sock_opt_init(void)
 		NEW_VAL(SO_RCVTIMEO, so, tv,
 		    VTIM_timeval(cache_param->timeout_idle));
 #endif
+		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