From 27a201ac808b4e759495a1b36df80b823bb8f015 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 12 Dec 2005 01:03:28 +0000 Subject: [PATCH] Have dirctory authorites note which servers make good V2 directory caches in publishe network-status. svn:r5574 --- src/or/dirserv.c | 7 +++++-- src/or/or.h | 3 +++ src/or/routerparse.c | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/or/dirserv.c b/src/or/dirserv.c index a92c4f7bae..dba82a1276 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -1299,6 +1299,8 @@ generate_v2_networkstatus(void) ri->cache_info.identity_digest); int f_named = naming && ri->is_named; int f_valid = ri->is_verified; + int f_v2_dir = ri->dir_port && + tor_version_as_new_as(ri->platform,"0.1.1.9-alpha"); char identity64[BASE64_DIGEST_LEN+1]; char digest64[BASE64_DIGEST_LEN+1]; if (options->AuthoritativeDir) { @@ -1316,7 +1318,7 @@ generate_v2_networkstatus(void) if (tor_snprintf(outp, endp-outp, "r %s %s %s %s %s %d %d\n" - "s%s%s%s%s%s%s%s\n", + "s%s%s%s%s%s%s%s%s\n", ri->nickname, identity64, digest64, @@ -1330,7 +1332,8 @@ generate_v2_networkstatus(void) f_named?" Named":"", f_stable?" Stable":"", f_running?" Running":"", - f_valid?" Valid":"")<0) { + f_valid?" Valid":"", + f_v2_dir?" V2Dir":"")<0) { warn(LD_BUG, "Unable to print router status."); goto done; } diff --git a/src/or/or.h b/src/or/or.h index e7edaa33a3..8d9d92697b 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -827,6 +827,9 @@ typedef struct routerstatus_t { unsigned int is_running:1; /**< True iff this router is up. */ unsigned int is_named:1; /**< True iff "nickname" belongs to this router. */ unsigned int is_valid:1; /**< True iff this router is validated. */ + unsigned int is_v2_dir:1; /**< True iff this router can serve router + * information with v2 of the directory + * protocol */ } routerstatus_t; /** DOCDOC */ diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 667d379ac1..e0f679b6df 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -1057,6 +1057,8 @@ routerstatus_parse_entry_from_string(const char **s, smartlist_t *tokens) rs->is_named = 1; else if (!strcmp(tok->args[i], "Valid")) rs->is_valid = 1; + else if (!strcmp(tok->args[i], "V2Dir")) + rs->is_v2_dir = 1; } } -- 2.47.3