"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/feature/dirclient/dirclient.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.

dirclient.c  (tor-0.4.6.3-rc):dirclient.c  (tor-0.4.6.4-rc)
skipping to change at line 2189 skipping to change at line 2189
"Received http status code %d (%s) from server " "Received http status code %d (%s) from server "
"%s while fetching consensus directory.", "%s while fetching consensus directory.",
status_code, escaped(reason), status_code, escaped(reason),
connection_describe_peer(TO_CONN(conn))); connection_describe_peer(TO_CONN(conn)));
networkstatus_consensus_download_failed(status_code, flavname); networkstatus_consensus_download_failed(status_code, flavname);
return -1; return -1;
} }
if (looks_like_a_consensus_diff(body, body_len)) { if (looks_like_a_consensus_diff(body, body_len)) {
/* First find our previous consensus. Maybe it's in ram, maybe not. */ /* First find our previous consensus. Maybe it's in ram, maybe not. */
cached_dir_t *cd = dirserv_get_consensus(flavname); cached_dir_t *cd = NULL;
const char *consensus_body = NULL; const char *consensus_body = NULL;
size_t consensus_body_len; size_t consensus_body_len;
tor_mmap_t *mapped_consensus = NULL; tor_mmap_t *mapped_consensus = NULL;
if (cd) {
consensus_body = cd->dir; /* We prefer the mmap'd version over the cached_dir_t version,
consensus_body_len = cd->dir_len; * since that matches the logic we used when we picked a consensus
* back in dir_consensus_request_set_additional_headers. */
mapped_consensus = networkstatus_map_cached_consensus(flavname);
if (mapped_consensus) {
consensus_body = mapped_consensus->data;
consensus_body_len = mapped_consensus->size;
} else { } else {
mapped_consensus = networkstatus_map_cached_consensus(flavname); cd = dirserv_get_consensus(flavname);
if (mapped_consensus) { if (cd) {
consensus_body = mapped_consensus->data; consensus_body = cd->dir;
consensus_body_len = mapped_consensus->size; consensus_body_len = cd->dir_len;
} }
} }
if (!consensus_body) { if (!consensus_body) {
log_warn(LD_DIR, "Received a consensus diff, but we can't find " log_warn(LD_DIR, "Received a consensus diff, but we can't find "
"any %s-flavored consensus in our current cache.",flavname); "any %s-flavored consensus in our current cache.",flavname);
tor_munmap_file(mapped_consensus); tor_munmap_file(mapped_consensus);
networkstatus_consensus_download_failed(0, flavname); networkstatus_consensus_download_failed(0, flavname);
// XXXX if this happens too much, see below // XXXX if this happens too much, see below
return -1; return -1;
} }
 End of changes. 3 change blocks. 
8 lines changed or deleted 13 lines changed or added

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