[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-bugs] #18881 [Core Tor/Stem]: speed up is_match() of stem/exit_policy.py
#18881: speed up is_match() of stem/exit_policy.py
-------------------------------+--------------------
Reporter: toralf | Owner: atagar
Type: defect | Status: new
Priority: Medium | Milestone:
Component: Core Tor/Stem | Version:
Severity: Normal | Keywords:
Actual Points: | Parent ID:
Points: | Reviewer:
Sponsor: |
-------------------------------+--------------------
I turns out to me, that the following code snipped
{{{
for conn in connections:
raddr, rport, lport = conn.remote_address, conn.remote_port,
conn.local_port
if policy.can_exit_to(raddr, rport):
Curr.setdefault(rport, []).append(str(lport) + ':' + raddr)
}}}
takes much longer than expected due to the fact, that policy.can_exit()
calls is_match() which itself makes a a lot of checks eg.:
{{{
# validate our input and check if the argument doesn't match our
address type
if address is not None:
}}}
For a relay having about 5,000 connections and about 100 ExitPolicy rules
thoses checks are repeated 500,000 times w/o too much profit, or ?
I do wonder if is_match() could get a wrapper which just does the given
address+port test against the exit policy ?
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/18881>
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