[tor-commits] [stem/master] Ensure accounting reset times are non-negative
atagar at torproject.org
atagar at torproject.org
Sun Dec 1 21:08:37 UTC 2019
commit 160915ad54fc835585c21e0d73f91c874d3db0a5
Author: Damian Johnson <atagar at torproject.org>
Date: Sun Dec 1 13:06:45 2019 -0800
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.
---
stem/control.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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,
More information about the tor-commits
mailing list