diff options
| author | Damian Johnson <atagar@torproject.org> | 2019-12-01 13:06:45 -0800 |
|---|---|---|
| committer | Damian Johnson <atagar@torproject.org> | 2019-12-01 13:06:45 -0800 |
| commit | 160915ad54fc835585c21e0d73f91c874d3db0a5 (patch) | |
| tree | b2e4522dc075b7f37c203c61b4c18e58b0af9ab3 | |
| parent | 728b71e1dfccb7c2fc350a03682217b26effaaeb (diff) | |
Ensure accounting reset times are non-negative
Huh. I lack a repro so unsure how this came about but someone reported a
negative reset time...
https://trac.torproject.org/projects/tor/ticket/32642
It would be nice to correct the root cause, but cest la vi. Ensuring these
counts are non-negative.
| -rw-r--r-- | stem/control.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/stem/control.py b/stem/control.py index 24640fd5..f0242b0d 100644 --- a/stem/control.py +++ b/stem/control.py @@ -1521,7 +1521,7 @@ class Controller(BaseController): retrieved = retrieved, status = status, interval_end = interval_end, - time_until_reset = calendar.timegm(interval_end.timetuple()) - int(retrieved), + time_until_reset = max(0, calendar.timegm(interval_end.timetuple()) - int(retrieved)), read_bytes = used_read, read_bytes_left = left_read, read_limit = used_read + left_read, |
