refactor the #19003 patches

fix the logic in one of the comments
This commit is contained in:
Roger Dingledine 2016-05-11 13:03:49 -04:00
parent c2817774c2
commit b8b5bccfd9
2 changed files with 12 additions and 11 deletions

View File

@ -1677,7 +1677,7 @@ circuit_launch(uint8_t purpose, int flags)
/* Do we have enough descriptors to build paths? /* Do we have enough descriptors to build paths?
* If need_exit is true, return 1 if we can build exit paths. * If need_exit is true, return 1 if we can build exit paths.
* (We need at least one Exit in the consensus to build exit paths.) * (We need at least one Exit in the consensus to build exit paths.)
* If need_exit is false, return 0 if we can build internal paths. * If need_exit is false, return 1 if we can build internal paths.
*/ */
static int static int
have_enough_path_info(int need_exit) have_enough_path_info(int need_exit)

View File

@ -1549,9 +1549,9 @@ proxy_mode(const or_options_t *options)
* and * and
* - We have ORPort set * - We have ORPort set
* and * and
* - We believe both our ORPort and DirPort (if present) are reachable from * - We believe our ORPort and DirPort (if present) are reachable from
* the outside; or * the outside; or
* - We believe both our ORPort is reachable from the outside, and we can't * - We believe our ORPort is reachable from the outside, and we can't
* check our DirPort because the consensus has no exits; or * check our DirPort because the consensus has no exits; or
* - We are an authoritative directory server. * - We are an authoritative directory server.
*/ */
@ -1570,14 +1570,15 @@ decide_if_publishable_server(void)
return 1; return 1;
if (!router_get_advertised_or_port(options)) if (!router_get_advertised_or_port(options))
return 0; return 0;
/* If there are no exits in the consensus, but have enough descriptors to if (!check_whether_orport_reachable())
* build internal paths, we can't possibly verify our DirPort. return 0;
* This only happens in small networks without exits. */ if (router_have_consensus_path() == CONSENSUS_PATH_INTERNAL) {
if (router_have_consensus_path() == CONSENSUS_PATH_INTERNAL) /* All set: there are no exits in the consensus (maybe this is a tiny
return check_whether_orport_reachable(); * test network), so we can't check our DirPort reachability. */
return 1;
/* If there are exits in the consensus, use an exit to check our DirPort. */ } else {
return check_whether_orport_reachable() && check_whether_dirport_reachable(); return check_whether_dirport_reachable();
}
} }
/** Initiate server descriptor upload as reasonable (if server is publishable, /** Initiate server descriptor upload as reasonable (if server is publishable,