From: Nick Mathewson Date: Tue, 6 May 2025 16:50:42 +0000 (-0400) Subject: Use RELAY_PAYLOAD_SIZE_MIN for some cc calculations X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=181885c230a78c04d4ae570f2a6e596c9ce98d4f;p=thirdparty%2Ftor.git Use RELAY_PAYLOAD_SIZE_MIN for some cc calculations These are for the cases where mikeperry and dgoulet had suggestions on !878. Closes #41064. --- diff --git a/src/core/or/congestion_control_flow.c b/src/core/or/congestion_control_flow.c index 9f3461a2d8..c1888a8949 100644 --- a/src/core/or/congestion_control_flow.c +++ b/src/core/or/congestion_control_flow.c @@ -71,15 +71,13 @@ double cc_stats_flow_xon_outbuf_ma = 0; void flow_control_new_consensus_params(const networkstatus_t *ns) { - // TODO CGO: These numbers might be wrong for the v1 cell format! - #define CC_XOFF_CLIENT_DFLT 500 #define CC_XOFF_CLIENT_MIN 1 #define CC_XOFF_CLIENT_MAX 10000 xoff_client = networkstatus_get_param(ns, "cc_xoff_client", CC_XOFF_CLIENT_DFLT, CC_XOFF_CLIENT_MIN, - CC_XOFF_CLIENT_MAX)*RELAY_PAYLOAD_SIZE_MAX; + CC_XOFF_CLIENT_MAX)*RELAY_PAYLOAD_SIZE_MIN; #define CC_XOFF_EXIT_DFLT 500 #define CC_XOFF_EXIT_MIN 1 @@ -87,7 +85,7 @@ flow_control_new_consensus_params(const networkstatus_t *ns) xoff_exit = networkstatus_get_param(ns, "cc_xoff_exit", CC_XOFF_EXIT_DFLT, CC_XOFF_EXIT_MIN, - CC_XOFF_EXIT_MAX)*RELAY_PAYLOAD_SIZE_MAX; + CC_XOFF_EXIT_MAX)*RELAY_PAYLOAD_SIZE_MIN; #define CC_XON_CHANGE_PCT_DFLT 25 #define CC_XON_CHANGE_PCT_MIN 1 @@ -479,8 +477,7 @@ flow_control_decide_xoff(edge_connection_t *stream) * do this because writes only happen when the socket unblocks, so * may not otherwise notice accumulation of data in the outbuf for * advisory XONs. */ - // TODO CGO: This might be wrong for the v1 cell format! - if (total_buffered > MAX_EXPECTED_CELL_BURST*RELAY_PAYLOAD_SIZE_MAX) { + if (total_buffered > MAX_EXPECTED_CELL_BURST*RELAY_PAYLOAD_SIZE_MIN) { flow_control_decide_xon(stream, 0); }