mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
Add a conflux helper to log conflux sets.
This commit is contained in:
parent
d4f4fb6088
commit
03d63bc7bd
@ -2020,6 +2020,51 @@ conflux_pool_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a description of all linked and unlinked circuits associated
|
||||
* with a conflux set.
|
||||
*
|
||||
* For use in rare bug cases that are hard to diagnose.
|
||||
*/
|
||||
void
|
||||
conflux_log_set(const conflux_t *cfx, bool is_client)
|
||||
{
|
||||
tor_assert(cfx);
|
||||
|
||||
log_warn(LD_BUG, "Conflux %s: %d linked, %d launched",
|
||||
fmt_nonce(cfx->nonce), smartlist_len(cfx->legs),
|
||||
cfx->num_leg_launch);
|
||||
|
||||
// Log all linked legs
|
||||
int legs = 0;
|
||||
CONFLUX_FOR_EACH_LEG_BEGIN(cfx, leg) {
|
||||
log_warn(LD_BUG,
|
||||
" - Linked Leg %d purpose=%d; RTT %"PRIu64", sent: %"PRIu64
|
||||
" marked: %d",
|
||||
legs, leg->circ->purpose, leg->circ_rtts_usec,
|
||||
leg->linked_sent_usec, leg->circ->marked_for_close);
|
||||
legs++;
|
||||
} CONFLUX_FOR_EACH_LEG_END(leg);
|
||||
|
||||
// Look up the nonce to see if we have any unlinked circuits.
|
||||
unlinked_circuits_t *unlinked = unlinked_pool_get(cfx->nonce, is_client);
|
||||
if (unlinked) {
|
||||
// Log the number of legs and the is_for_linked_set status
|
||||
log_warn(LD_BUG, " - Unlinked set: %d legs, for link: %d",
|
||||
smartlist_len(unlinked->legs), unlinked->is_for_linked_set);
|
||||
legs = 0;
|
||||
SMARTLIST_FOREACH_BEGIN(unlinked->legs, leg_t *, leg) {
|
||||
log_warn(LD_BUG,
|
||||
" Unlinked Leg: %d purpose=%d; linked: %d, RTT %"PRIu64", "
|
||||
"sent: %"PRIu64" link ptr %p, marked: %d",
|
||||
legs, leg->circ->purpose, leg->linked,
|
||||
leg->rtt_usec, leg->link_sent_usec,
|
||||
leg->link, leg->circ->marked_for_close);
|
||||
legs++;
|
||||
} SMARTLIST_FOREACH_END(leg);
|
||||
}
|
||||
}
|
||||
|
||||
/** Free and clean up the conflux pool subsystem. This is called by the subsys
|
||||
* manager AFTER all circuits have been freed which implies that all objects in
|
||||
* the pools aren't referenced anymore. */
|
||||
|
@ -36,6 +36,9 @@ void conflux_process_linked(circuit_t *circ, crypt_path_t *layer_hint,
|
||||
const cell_t *cell, const uint16_t cell_len);
|
||||
void conflux_process_linked_ack(circuit_t *circ);
|
||||
|
||||
typedef struct conflux_t conflux_t;
|
||||
void conflux_log_set(const conflux_t *cfx, bool is_client);
|
||||
|
||||
#ifdef TOR_UNIT_TESTS
|
||||
bool launch_new_set(int num_legs);
|
||||
digest256map_t *get_linked_pool(bool is_client);
|
||||
|
Loading…
Reference in New Issue
Block a user