aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Elizabeth Scott <beth@torproject.org>2023-04-06 09:29:37 -0700
committerMicah Elizabeth Scott <beth@torproject.org>2023-05-10 07:41:37 -0700
commita6138486f7e21cd1c3da7527ca1e816acfa5b1a2 (patch)
treefda7103fa5e0e091404fa660d168346827e6332d
parentee63863dcad8eb88584e67beaa2618cbb9f24127 (diff)
downloadtor-a6138486f7e21cd1c3da7527ca1e816acfa5b1a2.tar.gz
tor-a6138486f7e21cd1c3da7527ca1e816acfa5b1a2.zip
hs_pow: review feedback, use MAX for max_trimmed_effort
Signed-off-by: Micah Elizabeth Scott <beth@torproject.org>
-rw-r--r--src/feature/hs/hs_circuit.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/feature/hs/hs_circuit.c b/src/feature/hs/hs_circuit.c
index 3978c69567..1287b2beda 100644
--- a/src/feature/hs/hs_circuit.c
+++ b/src/feature/hs/hs_circuit.c
@@ -680,8 +680,8 @@ trim_rend_pqueue(hs_pow_service_state_t *pow_state, time_t now)
log_info(LD_REND, "While trimming, rend request has been pending "
"for too long; discarding.");
- if (req->rdv_data.pow_effort > pow_state->max_trimmed_effort)
- pow_state->max_trimmed_effort = req->rdv_data.pow_effort;
+ pow_state->max_trimmed_effort = MAX(pow_state->max_trimmed_effort,
+ req->rdv_data.pow_effort);
free_pending_rend(req);
} else {
@@ -694,9 +694,8 @@ trim_rend_pqueue(hs_pow_service_state_t *pow_state, time_t now)
/* Ok, we have rescued all the entries we want to keep. The rest are
* all excess. */
SMARTLIST_FOREACH_BEGIN(old_pqueue, pending_rend_t *, req) {
- if (req->rdv_data.pow_effort > pow_state->max_trimmed_effort)
- pow_state->max_trimmed_effort = req->rdv_data.pow_effort;
-
+ pow_state->max_trimmed_effort = MAX(pow_state->max_trimmed_effort,
+ req->rdv_data.pow_effort);
free_pending_rend(req);
} SMARTLIST_FOREACH_END(req);
smartlist_free(old_pqueue);