tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit a56434a82beefcd6d4d465489edd972fc4d80dae
parent 72164740a239d769c2b09b0dc875c072bed45c2b
Author: Mike Perry <mikeperry-git@torproject.org>
Date:   Tue, 15 Aug 2023 15:04:38 +0000

Bug 40834: Remove assert and add logs to track no-leg case

Diffstat:
Msrc/core/or/conflux.c | 8++++++--
Msrc/core/or/relay.c | 3++-
2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/core/or/conflux.c b/src/core/or/conflux.c @@ -467,8 +467,12 @@ conflux_decide_circ_for_send(conflux_t *cfx, * so these commands arrive in-order. */ if (!new_circ && relay_command != RELAY_COMMAND_DATA) { /* Curr leg should be set, because conflux_decide_next_circ() should - * have set it earlier. */ - tor_assert(cfx->curr_leg); + * have set it earlier. No BUG() here because the only caller BUG()s. */ + if (!cfx->curr_leg) { + log_warn(LD_BUG, "No current leg for conflux with relay command %d", + relay_command); + return NULL; + } return cfx->curr_leg->circ; } diff --git a/src/core/or/relay.c b/src/core/or/relay.c @@ -639,7 +639,8 @@ relay_send_command_from_edge_,(streamid_t stream_id, circuit_t *orig_circ, circ = conflux_decide_circ_for_send(orig_circ->conflux, orig_circ, relay_command); if (BUG(!circ)) { - log_warn(LD_BUG, "No circuit to send on for conflux"); + log_warn(LD_BUG, "No circuit to send for conflux for relay command %d, " + "called from %s:%d", relay_command, filename, lineno); circ = orig_circ; } else { /* Conflux circuits always send multiplexed relay commands to