diff options
author | Roger Dingledine <arma@torproject.org> | 2007-10-13 22:31:35 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2007-10-13 22:31:35 +0000 |
commit | 39902e93f75bbdf850eb898c847583ed46747865 (patch) | |
tree | 3bfaeae98efe3b2319bd7af787ae919ac5c0a8e1 /src/or/router.c | |
parent | d9ba4d3e8ba7c192c29c14952fdb16acd8b16622 (diff) | |
download | tor-39902e93f75bbdf850eb898c847583ed46747865.tar.gz tor-39902e93f75bbdf850eb898c847583ed46747865.zip |
Stop publishing a new server descriptor just because we HUP or
when we find our DirPort to be reachable but won't actually publish
it. Extra descriptors without any real changes are dropped by the
authorities, and can screw up our "publish every 18 hours" schedule.
svn:r11915
Diffstat (limited to 'src/or/router.c')
-rw-r--r-- | src/or/router.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/or/router.c b/src/or/router.c index 105b1c11a3..b0fea7e8ff 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -597,7 +597,7 @@ check_whether_dirport_reachable(void) * a DirPort. */ static int -decide_to_advertise_dirport(or_options_t *options, routerinfo_t *router) +decide_to_advertise_dirport(or_options_t *options, uint16_t dir_port) { static int advertising=1; /* start out assuming we will advertise */ int new_choice=1; @@ -607,10 +607,10 @@ decide_to_advertise_dirport(or_options_t *options, routerinfo_t *router) * worth mentioning to the user, either because they're obvious * or because they're normal behavior. */ - if (!router->dir_port) /* short circuit the rest of the function */ + if (!dir_port) /* short circuit the rest of the function */ return 0; if (authdir_mode(options)) /* always publish */ - return router->dir_port; + return dir_port; if (we_are_hibernating()) return 0; if (!check_whether_dirport_reachable()) @@ -635,7 +635,7 @@ decide_to_advertise_dirport(or_options_t *options, routerinfo_t *router) if (advertising != new_choice) { if (new_choice == 1) { - log(LOG_NOTICE, LD_DIR, "Advertising DirPort as %d", router->dir_port); + log(LOG_NOTICE, LD_DIR, "Advertising DirPort as %d", dir_port); } else { tor_assert(reason); log(LOG_NOTICE, LD_DIR, "Not advertising DirPort (Reason: %s)", reason); @@ -643,7 +643,7 @@ decide_to_advertise_dirport(or_options_t *options, routerinfo_t *router) advertising = new_choice; } - return advertising ? router->dir_port : 0; + return advertising ? dir_port : 0; } /** Some time has passed, or we just got new directory information. @@ -722,7 +722,8 @@ router_dirport_found_reachable(void) log_notice(LD_DIRSERV,"Self-testing indicates your DirPort is reachable " "from the outside. Excellent."); can_reach_dir_port = 1; - mark_my_descriptor_dirty(); + if (!me || decide_to_advertise_dirport(get_options(), me->dir_port)) + mark_my_descriptor_dirty(); if (!me) return; control_event_server_status(LOG_NOTICE, @@ -1553,7 +1554,7 @@ router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router, router->nickname, router->address, router->or_port, - decide_to_advertise_dirport(options, router), + decide_to_advertise_dirport(options, router->dir_port), router->platform, published, fingerprint, |