diff options
author | juga0 <juga@riseup.net> | 2018-07-02 08:21:43 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-09-01 18:47:20 -0400 |
commit | e033d98f79a950a342a7db6909709b5dc987b2cb (patch) | |
tree | af335db769e1fdb9436b9538e7329b1e0bd422cd /src/or | |
parent | 1066fdd8d1e084ef38281c9817032e68e2a490ff (diff) | |
download | tor-e033d98f79a950a342a7db6909709b5dc987b2cb.tar.gz tor-e033d98f79a950a342a7db6909709b5dc987b2cb.zip |
Check descriptor bandwidth changed if not hibernating
There should be a separate check to update descriptor when start
or end hibernating.
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/router.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/or/router.c b/src/or/router.c index 4afba65491..f1a99364e6 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -2440,17 +2440,18 @@ check_descriptor_bandwidth_changed(time_t now) { static time_t last_changed = 0; uint64_t prev, cur; + int hibernating = we_are_hibernating(); /* If the relay uptime is bigger than MAX_UPTIME_BANDWIDTH_CHANGE, * the next regularly scheduled descriptor update (18h) will be enough */ - if (get_uptime() > MAX_UPTIME_BANDWIDTH_CHANGE) + if (get_uptime() > MAX_UPTIME_BANDWIDTH_CHANGE && !hibernating) return; if (!router_get_my_routerinfo()) return; prev = router_get_my_routerinfo()->bandwidthcapacity; - cur = we_are_hibernating() ? 0 : rep_hist_bandwidth_assess(); + cur = hibernating ? 0 : rep_hist_bandwidth_assess(); if ((prev != cur && (!prev || !cur)) || cur > (prev * BANDWIDTH_CHANGE_FACTOR) || cur < (prev / BANDWIDTH_CHANGE_FACTOR) ) { |