From e2dc45a2e1f12bb19b7ce33fb71042f5473d79d2 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Fri, 21 Dec 2007 06:28:59 +0000 Subject: [PATCH] some more refactoring svn:r12897 --- src/or/router.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/or/router.c b/src/or/router.c index 2cacb5f031..aded6e77c6 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -823,16 +823,20 @@ authdir_mode_v3(or_options_t *options) { return authdir_mode(options) && options->V3AuthoritativeDir != 0; } +static int +authdir_mode_any_main(or_options_t *options) +{ + return options->V1AuthoritativeDir || + options->V2AuthoritativeDir || + options->V3AuthoritativeDir; +} /** Return true if we believe ourselves to be any kind of * authoritative directory beyond just a hidserv authority. */ int authdir_mode_any_nonhidserv(or_options_t *options) { - return authdir_mode(options) && - (options->BridgeAuthoritativeDir || - options->V1AuthoritativeDir || - options->V2AuthoritativeDir || - options->V3AuthoritativeDir); + return options->BridgeAuthoritativeDir || + authdir_mode_any_main(options); } /** Return true iff we are an authoritative directory server that is * authoritative about receiving and serving descriptors of type @@ -843,9 +847,7 @@ authdir_mode_handles_descs(or_options_t *options, int purpose) if (purpose < 0) return authdir_mode_any_nonhidserv(options); else if (purpose == ROUTER_PURPOSE_GENERAL) - return (options->V1AuthoritativeDir || - options->V2AuthoritativeDir || - options->V3AuthoritativeDir); + return authdir_mode_any_main(options); else if (purpose == ROUTER_PURPOSE_BRIDGE) return (options->BridgeAuthoritativeDir); else