"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/feature/control/control_getinfo.c" between
tor-0.4.6.3-rc.tar.gz and tor-0.4.6.4-rc.tar.gz

About: Tor is an anonymous Internet communication system - a network of virtual tunnels that allows people and groups to improve their privacy and security on the Internet. Release candidate.

control_getinfo.c  (tor-0.4.6.3-rc):control_getinfo.c  (tor-0.4.6.4-rc)
skipping to change at line 355 skipping to change at line 355
STATIC int STATIC int
getinfo_helper_current_consensus(consensus_flavor_t flavor, getinfo_helper_current_consensus(consensus_flavor_t flavor,
char** answer, char** answer,
const char** errmsg) const char** errmsg)
{ {
const char *flavor_name = networkstatus_get_flavor_name(flavor); const char *flavor_name = networkstatus_get_flavor_name(flavor);
if (BUG(!strcmp(flavor_name, "??"))) { if (BUG(!strcmp(flavor_name, "??"))) {
*errmsg = "Internal error: unrecognized flavor name."; *errmsg = "Internal error: unrecognized flavor name.";
return -1; return -1;
} }
if (we_want_to_fetch_flavor(get_options(), flavor)) { tor_mmap_t *mapped = networkstatus_map_cached_consensus(flavor_name);
/** Check from the cache */ if (mapped) {
const cached_dir_t *consensus = dirserv_get_consensus(flavor_name); *answer = tor_memdup_nulterm(mapped->data, mapped->size);
if (consensus) { tor_munmap_file(mapped);
*answer = tor_strdup(consensus->dir);
}
} }
if (!*answer) { /* try loading it from disk */ if (!*answer) { /* Maybe it's in the cache? */
if (we_want_to_fetch_flavor(get_options(), flavor)) {
tor_mmap_t *mapped = networkstatus_map_cached_consensus(flavor_name); const cached_dir_t *consensus = dirserv_get_consensus(flavor_name);
if (mapped) { if (consensus) {
*answer = tor_memdup_nulterm(mapped->data, mapped->size); *answer = tor_strdup(consensus->dir);
tor_munmap_file(mapped); }
}
if (!*answer) { /* generate an error */
*errmsg = "Could not open cached consensus. "
"Make sure FetchUselessDescriptors is set to 1.";
return -1;
} }
} }
if (!*answer) { /* generate an error */
*errmsg = "Could not open cached consensus. "
"Make sure FetchUselessDescriptors is set to 1.";
return -1;
}
return 0; return 0;
} }
/** Helper for getinfo_helper_dir. /** Helper for getinfo_helper_dir.
* *
* Add a signed_descriptor_t to <b>descs_out</b> for each router matching * Add a signed_descriptor_t to <b>descs_out</b> for each router matching
* <b>key</b>. The key should be either * <b>key</b>. The key should be either
* - "/tor/server/authority" for our own routerinfo; * - "/tor/server/authority" for our own routerinfo;
* - "/tor/server/all" for all the routerinfos we have, concatenated; * - "/tor/server/all" for all the routerinfos we have, concatenated;
* - "/tor/server/fp/FP" where FP is a plus-separated sequence of * - "/tor/server/fp/FP" where FP is a plus-separated sequence of
 End of changes. 3 change blocks. 
17 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)