[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/release-0.3.4] Merge remote-tracking branch 'public/bug24104_029_squashed' into maint-0.2.9



commit 8569166c70f99bf908e78ce272e71eb60cdc84d0
Merge: 7f042cbc0 81f422332
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Thu Nov 15 16:43:50 2018 -0500

    Merge remote-tracking branch 'public/bug24104_029_squashed' into maint-0.2.9
    
    Resolved conflicts with the 26269 fix in 015fcd0e1191aa6f.

 changes/bug24104            |   4 ++
 src/or/rephist.c            |   6 +-
 src/or/rephist.h            |   4 +-
 src/or/router.c             |  25 ++++++--
 src/test/include.am         |   1 +
 src/test/log_test_helpers.c |  22 ++++++-
 src/test/log_test_helpers.h |   7 ++-
 src/test/test.c             |   1 +
 src/test/test_router.c      | 142 ++++++++++++++++++++++++++++++++++++++++++++
 9 files changed, 200 insertions(+), 12 deletions(-)

diff --cc src/or/router.c
index 35b6bd203,f1a99364e..c41647422
--- a/src/or/router.c
+++ b/src/or/router.c
@@@ -2433,15 -2440,21 +2441,23 @@@ check_descriptor_bandwidth_changed(time
  {
    static time_t last_changed = 0;
    uint64_t prev, cur;
 +  const routerinfo_t *my_ri = router_get_my_routerinfo();
++
+   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 && !hibernating)
+     return;
+ 
 -  if (!router_get_my_routerinfo())
 +  if (!my_ri) /* make sure routerinfo exists */
      return;
  
 -  prev = router_get_my_routerinfo()->bandwidthcapacity;
 +  prev = my_ri->bandwidthcapacity;
-   cur = we_are_hibernating() ? 0 : rep_hist_bandwidth_assess();
+   cur = hibernating ? 0 : rep_hist_bandwidth_assess();
    if ((prev != cur && (!prev || !cur)) ||
-       cur > prev*2 ||
-       cur < prev/2) {
+       cur > (prev * BANDWIDTH_CHANGE_FACTOR) ||
+       cur < (prev / BANDWIDTH_CHANGE_FACTOR) ) {
      if (last_changed+MAX_BANDWIDTH_CHANGE_FREQ < now || !prev) {
        log_info(LD_GENERAL,
                 "Measured bandwidth has changed; rebuilding descriptor.");
@@@ -3640,4 -3652,4 +3656,3 @@@ router_get_all_orports(const routerinfo
    fake_node.ri = (routerinfo_t *)ri;
    return node_get_all_orports(&fake_node);
  }
--



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits