aboutsummaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2005-10-12 22:41:16 +0000
committerPeter Palfrader <peter@palfrader.org>2005-10-12 22:41:16 +0000
commit8808b262068b6998a5be9dd6eabf50be82efe8a2 (patch)
tree07bfcf0d1b5ae67addc54298a7b1cc4a064a0370 /src/or/main.c
parent640211e59aaecb8babaccda2c06c70fc8dae3a46 (diff)
downloadtor-8808b262068b6998a5be9dd6eabf50be82efe8a2.tar
tor-8808b262068b6998a5be9dd6eabf50be82efe8a2.tar.gz
Check if our IP address has changed every 5 minutes. If it has, update our server descriptor, but not too often
svn:r5246
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 28913e11b..81ce77216 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -94,6 +94,7 @@ static char* nt_strerror(uint32_t errnum);
#define FORCE_REGENERATE_DESCRIPTOR_INTERVAL 18*60*60 /* 18 hours */
#define CHECK_DESCRIPTOR_INTERVAL 60 /* one minute */
+#define CHECK_IPADDRESS_INTERVAL (5*60) /* five minutes */
#define BUF_SHRINK_INTERVAL 60 /* one minute */
#define DESCRIPTOR_RETRY_INTERVAL 10
#define DESCRIPTOR_FAILURE_RESET_INTERVAL 60*60
@@ -637,6 +638,7 @@ run_scheduled_events(time_t now)
static time_t last_rotated_certificate = 0;
static time_t time_to_check_listeners = 0;
static time_t time_to_check_descriptor = 0;
+ static time_t time_to_check_ipaddress = 0;
static time_t time_to_shrink_buffers = 0;
static time_t time_to_try_getting_descriptors = 0;
static time_t time_to_reset_descriptor_failures = 0;
@@ -744,6 +746,10 @@ run_scheduled_events(time_t now)
if (time_to_check_descriptor < now) {
time_to_check_descriptor = now + CHECK_DESCRIPTOR_INTERVAL;
check_descriptor_bandwidth_changed(now);
+ if (time_to_check_ipaddress < now) {
+ time_to_check_ipaddress = now + CHECK_IPADDRESS_INTERVAL;
+ check_descriptor_ipaddress_changed(now);
+ }
mark_my_descriptor_dirty_if_older_than(
now - FORCE_REGENERATE_DESCRIPTOR_INTERVAL);
consider_publishable_server(now, 0);