[tor-bugs] #12862 [Tor]: Refactor code to modify circ->n_chan only by circuit_set_circid_chan_helper
Tor Bug Tracker & Wiki
blackhole at torproject.org
Fri Oct 3 23:41:32 UTC 2014
#12862: Refactor code to modify circ->n_chan only by circuit_set_circid_chan_helper
-------------------------+-------------------------------------------------
Reporter: | Owner:
cypherpunks | Status: new
Type: | Milestone: Tor: 0.2.6.x-final
enhancement | Version:
Priority: minor | Keywords: tor-relay 026-triaged-1
Component: Tor | 026-deferrable
Resolution: | Parent ID:
Actual Points: |
Points: |
-------------------------+-------------------------------------------------
Comment (by andrea):
There's no bug here, and this ticket is just griping that old_chan (and
old_id too) are copies of *chan_ptr and *circid_ptr in the first half of
circuit_set_circid_chan_helper(), AFAICT.
Refactoring wouldn't eliminate the old_chan/old_id local variables, since
we also need them after we change the channel/circuit id to decide whether
we need to circuitmux_attach_circuit(). It'd only change the references
to old_chan/old_id to *chan_ptr/*circid_ptr in the if-clause tests prior
to the channel/circuit id change.
I'm not sure changing this actually counts as an improvement. The
existing names make it manifestly clear that it's comparing the existing
channel or circuit id to the value we're setting to, and thus that the
purpose of the test is to detect if we have a real change or one/both of
them is remaining constant. It'd also introduce an inconsistency in usage
between the ones before the assignment and the circuitmux_attach_circuit()
test after, where these are at present nicely symmetrical.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/12862#comment:4>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list