diff options
author | Sebastian Hahn <sebastian@torproject.org> | 2014-08-30 08:36:20 +0200 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-09-02 18:54:56 -0400 |
commit | 14abf1c3f1534da308eb221fef483a293d449d4f (patch) | |
tree | 8d1aa159d40066df8077e6b974b086412b4f50ab /src/or/router.c | |
parent | bce32e0a356bc9d0b95a34301c6f3cc54622c4bb (diff) | |
download | tor-14abf1c3f1534da308eb221fef483a293d449d4f.tar.gz tor-14abf1c3f1534da308eb221fef483a293d449d4f.zip |
Don't delay uploading a new desc if bw estimate was 0
When a tor relay starts up and has no historical information about its
bandwidth capability, it uploads a descriptor with a bw estimate of 0.
It then starts its bw selftest, but has to wait 20 minutes to upload the
next descriptor due to the MAX_BANDWIDTH_CHANGE_FREQ delay. This change
should mean that on average, relays start seeing meaningful traffic a
little quicker, since they will have a higher chance to appear in the
consensus with a nonzero bw.
Patch by Roger, changes file and comment by Sebastian.
Diffstat (limited to 'src/or/router.c')
-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 87b6705d84..4d1e74e731 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -2063,7 +2063,8 @@ mark_my_descriptor_dirty(const char *reason) } /** How frequently will we republish our descriptor because of large (factor - * of 2) shifts in estimated bandwidth? */ + * of 2) shifts in estimated bandwidth? Note: We don't use this constant + * if our previous bandwidth estimate was exactly 0. */ #define MAX_BANDWIDTH_CHANGE_FREQ (20*60) /** Check whether bandwidth has changed a lot since the last time we announced @@ -2081,7 +2082,7 @@ check_descriptor_bandwidth_changed(time_t now) if ((prev != cur && (!prev || !cur)) || cur > prev*2 || cur < prev/2) { - if (last_changed+MAX_BANDWIDTH_CHANGE_FREQ < now) { + if (last_changed+MAX_BANDWIDTH_CHANGE_FREQ < now || !prev) { log_info(LD_GENERAL, "Measured bandwidth has changed; rebuilding descriptor."); mark_my_descriptor_dirty("bandwidth has changed"); |