[tor-bugs] #26056 [Core Tor/Stem]: Stem should optionally timeout when building circuits

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri May 11 13:40:25 UTC 2018


#26056: Stem should optionally timeout when building circuits
---------------------------+------------------------
 Reporter:  pastly         |          Owner:  atagar
     Type:  enhancement    |         Status:  new
 Priority:  Medium         |      Milestone:
Component:  Core Tor/Stem  |        Version:
 Severity:  Normal         |     Resolution:
 Keywords:  controller     |  Actual Points:
Parent ID:                 |         Points:
 Reviewer:                 |        Sponsor:
---------------------------+------------------------

Comment (by pastly):

 Oh man this is great. It felt good deleting all the code I just wrote.

 One thing though: it always times out immediately in the first `raise
 stem.Timeout(...)`. I think `time_left` is calculated incorrectly and
 should be done like this.

 {{{
 (venv-editable) [matt at zen stem]$ git diff
 diff --git a/stem/control.py b/stem/control.py
 index 244aed0b..a9d33749 100644
 --- a/stem/control.py
 +++ b/stem/control.py
 @@ -4025,7 +4025,7 @@ def _get_with_timeout(event_queue, timeout,
 start_time):
    """

    if timeout:
 -    time_left = time.time() - start_time - timeout
 +    time_left = timeout - (time.time() - start_time)

      if time_left <= 0:
        raise stem.Timeout('Reached our %0.1f second timeout' % timeout)
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/26056#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list