commit 181885c230a78c04d4ae570f2a6e596c9ce98d4f
parent 79ae64f1e91bb3d291a2fa6312622e52a0bd6dd4
Author: Nick Mathewson <nickm@torproject.org>
Date: Tue, 6 May 2025 12:50:42 -0400
Use RELAY_PAYLOAD_SIZE_MIN for some cc calculations
These are for the cases where mikeperry and dgoulet had suggestions
on !878.
Closes #41064.
Diffstat:
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git 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);
}