[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #7479 [Core Tor/Tor]: Replace more linked lists with queue.h implementations
#7479: Replace more linked lists with queue.h implementations
----------------------------------------------+----------------------------
Reporter: nickm | Owner:
Type: defect | Status: new
Priority: Low | Milestone: Tor:
| unspecified
Component: Core Tor/Tor | Version:
Severity: Normal | Resolution:
Keywords: tor-relay refactoring easy intro | Actual Points:
Parent ID: | Points:
Reviewer: | Sponsor:
----------------------------------------------+----------------------------
Comment (by arma):
Replying to [comment:1 nickm]:
> * crypt_path_t (weird circular list. I forget why it is circular.)
It is almost entirely so we can have easy access to "the last hop in the
circuit" just by looking at cpath->prev.
There are a couple of places where we use the reverse links, e.g.
{{{
if (circ->cpath &&
circ->cpath->prev->state != CPATH_STATE_OPEN &&
circ->cpath->prev->prev->state == CPATH_STATE_OPEN) {
failed_at_last_hop = 1;
}
}}}
but those could probably be refactored or just turned into a more brute
force walk over the forward list, if we needed.
Though, check out this use in circuit_package_relay_cell() where it is
honestly more convenient to be able to walk backwards on the list:
{{{
thishop = layer_hint;
/* moving from farthest to nearest hop */
do {
tor_assert(thishop);
log_debug(LD_OR,"crypting a layer of the relay cell.");
if (relay_crypt_one_payload(thishop->f_crypto, cell->payload, 1) <
0) {
return -1;
}
thishop = thishop->prev;
} while (thishop != TO_ORIGIN_CIRCUIT(circ)->cpath->prev);
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/7479#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs