]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Check descriptor bandwidth changed if not hibernating
authorjuga0 <juga@riseup.net>
Mon, 2 Jul 2018 08:21:43 +0000 (08:21 +0000)
committerNick Mathewson <nickm@torproject.org>
Sat, 1 Sep 2018 22:47:20 +0000 (18:47 -0400)
There should be a separate check to update descriptor when start
or end hibernating.

src/or/router.c

index 4afba654914fa7a1f38a1e4ed8a00dfaf512dd75..f1a99364e6ec96a3331412bc34c79613cee7cb10 100644 (file)
@@ -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) ) {