aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorjuga0 <juga@riseup.net>2018-06-03 09:31:19 +0000
committerjuga0 <juga@riseup.net>2018-06-03 18:24:27 +0000
commit7d70f67deaeea1a3dc80a763f13bcec5d7a2425d (patch)
tree5a14b1d9be035fc9a0646ca514fd176771c3a5ad /src/or
parentc380562aed5242eab6449b054199d742f02833dd (diff)
downloadtor-7d70f67deaeea1a3dc80a763f13bcec5d7a2425d.tar.gz
tor-7d70f67deaeea1a3dc80a763f13bcec5d7a2425d.zip
Check bandwidth changes only if small uptime
to upload a new descriptor.
Diffstat (limited to 'src/or')
-rw-r--r--src/or/router.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 31f2ff00d2..ab916fb6e6 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -2425,13 +2425,24 @@ mark_my_descriptor_dirty(const char *reason)
* if our previous bandwidth estimate was exactly 0. */
#define MAX_BANDWIDTH_CHANGE_FREQ (3*60*60)
+/** Maximum uptime to republish our descriptor because of large shifts in
+ * estimated bandwidth. */
+#define MAX_UPTIME_BANDWIDTH_CHANGE (24*60*60)
+
/** Check whether bandwidth has changed a lot since the last time we announced
- * bandwidth. If so, mark our descriptor dirty. */
+ * bandwidth while the uptime is smaller than MAX_UPTIME_BANDWIDTH_CHANGE.
+ * If so, mark our descriptor dirty. */
void
check_descriptor_bandwidth_changed(time_t now)
{
static time_t last_changed = 0;
uint64_t prev, cur;
+
+ /* 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)
+ return;
+
if (!router_get_my_routerinfo())
return;