Have dirctory authorites note which servers make good V2 directory caches in publishe network-status.

svn:r5574
This commit is contained in:
Nick Mathewson 2005-12-12 01:03:28 +00:00
parent 32126cced1
commit 27a201ac80
3 changed files with 10 additions and 2 deletions

View File

@ -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;
}

View File

@ -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 */

View File

@ -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;
}
}