[tor-bugs] #18873 [Core Tor/Tor]: Refactor circuit_predict_and_launch_new()
Tor Bug Tracker & Wiki
blackhole at torproject.org
Wed Nov 2 18:16:35 UTC 2016
#18873: Refactor circuit_predict_and_launch_new()
--------------------------+------------------------------------
Reporter: asn | Owner:
Type: defect | Status: needs_revision
Priority: Low | Milestone: Tor: 0.3.0.x-final
Component: Core Tor/Tor | Version:
Severity: Normal | Resolution:
Keywords: refactoring | Actual Points:
Parent ID: | Points:
Reviewer: dgoulet | Sponsor:
--------------------------+------------------------------------
Comment (by chelseakomlo):
Replying to [comment:17 dgoulet]:
> Replying to [comment:15 chelseakomlo]:
[snip]
> > Hey! Ok, here is my understanding:
> >
> > A circuit with purpose CIRCUIT_PURPOSE_C_GENERAL will always be an
origin circuit, because:
> >
> > in or.h
> > {{{
> > #define CIRCUIT_IS_ORIGIN(c) (CIRCUIT_PURPOSE_IS_ORIGIN((c)->purpose))
> > #define CIRCUIT_PURPOSE_IS_ORIGIN(p) ((p)>CIRCUIT_PURPOSE_OR_MAX_)
> > #define CIRCUIT_PURPOSE_OR_MAX_ 4
> > #define CIRCUIT_PURPOSE_C_GENERAL 5
> > }}}
> >
>
> I see that `CIRCUIT_IS_ORIGIN(c)` translates to `if c >
CIRCUIT_PURPOSE_OR_MAX_ then circ is origin`. We have lots of purposes
that are above `CIRCUIT_PURPOSE_C_GENERAL = 5` in values like a client
doing an HS introduction to a relay `CIRCUIT_PURPOSE_C_INTRODUCING = 6`.
Am I missing something here?
>
> Origin circuits means that we (tor) initiated them and just with the HS,
there are lots of purposes.
In circuit_is_available_for_use, we exclude all circuits that don't have
purpose `CIRCUIT_PURPOSE_C_GENERAL,` which is an origin circuit. See line
1023.
I can add a comment in the code explaining this if it isn't clear in the
code.
>
> I think you missed this syntax fix as well:
>
> {{{
> #define CBT_MAX_UNUSED_OPEN_CIRCUITS (MAX_UNUSED_OPEN_CIRCUITS- \
> CBT_MIN_REMAINING_PREEMPTIVE_CIRCUITS)
> }}}
That change is in commit `extract magic numbers in circuituse.c`
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/18873#comment:18>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list