diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-12-28 21:29:20 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-12-28 21:29:20 +0000 |
commit | d9f1f3533d059627266ddcdb0398b4b32c7158f2 (patch) | |
tree | a087dc505639ec0108a087360a489dde56be3f4e /src/or/router.c | |
parent | e5f5b96ca6bc35d22478840600c2dfdf2778950f (diff) | |
download | tor-d9f1f3533d059627266ddcdb0398b4b32c7158f2.tar.gz tor-d9f1f3533d059627266ddcdb0398b4b32c7158f2.zip |
r11724@Kushana: nickm | 2006-12-28 14:22:35 -0500
Refactor and unify my-ip-addr-changed logic. Make change in IP address or in nameservers reset and relaunch DNS hijacking tests.
svn:r9200
Diffstat (limited to 'src/or/router.c')
-rw-r--r-- | src/or/router.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/or/router.c b/src/or/router.c index 48c70039a9..546e29d4b0 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -381,6 +381,13 @@ static int can_reach_or_port = 0; /** Whether we can reach our DirPort from the outside. */ static int can_reach_dir_port = 0; +/** DOCDOC */ +void +router_reset_reachability(void) +{ + can_reach_or_port = can_reach_dir_port = 0; +} + /** Return 1 if ORPort is known reachable; else return 0. */ int check_whether_orport_reachable(void) @@ -488,20 +495,6 @@ router_dirport_found_reachable(void) } } -#define UPTIME_CUTOFF_FOR_NEW_BANDWIDTH_TEST (6*60*60) - -/** Our router has just moved to a new IP. Reset stats. */ -void -server_has_changed_ip(void) -{ - if (stats_n_seconds_working > UPTIME_CUTOFF_FOR_NEW_BANDWIDTH_TEST) - reset_bandwidth_test(); - stats_n_seconds_working = 0; - can_reach_or_port = 0; - can_reach_dir_port = 0; - mark_my_descriptor_dirty(); -} - /** We have enough testing circuits open. Send a bunch of "drop" * cells down each of them, to exercise our bandwidth. */ void @@ -996,9 +989,7 @@ check_descriptor_ipaddress_changed(time_t now) if (prev != cur) { log_addr_has_changed(LOG_INFO, prev, cur); - mark_my_descriptor_dirty(); - /* the above call is probably redundant, since resolve_my_address() - * probably already noticed and marked it dirty. */ + ip_address_changed(0); } } @@ -1044,7 +1035,7 @@ router_new_address_suggestion(const char *suggestion) * resolve it. */ if (last_guessed_ip != addr) { log_addr_has_changed(LOG_NOTICE, last_guessed_ip, addr); - server_has_changed_ip(); + ip_address_changed(0); last_guessed_ip = addr; /* router_rebuild_descriptor() will fetch it */ } } |