Merge remote-tracking branch 'public/bug2381'

This commit is contained in:
Nick Mathewson 2011-04-06 16:19:41 -04:00
commit 13f60e16eb
2 changed files with 12 additions and 8 deletions

View File

@ -631,9 +631,8 @@ connection_dir_request_failed(dir_connection_t *conn)
connection_dir_bridge_routerdesc_failed(conn); connection_dir_bridge_routerdesc_failed(conn);
connection_dir_download_routerdesc_failed(conn); connection_dir_download_routerdesc_failed(conn);
} else if (conn->_base.purpose == DIR_PURPOSE_FETCH_CONSENSUS) { } else if (conn->_base.purpose == DIR_PURPOSE_FETCH_CONSENSUS) {
const char *flavname = if (conn->requested_resource)
conn->requested_resource ? conn->requested_resource : "ns"; networkstatus_consensus_download_failed(0, conn->requested_resource);
networkstatus_consensus_download_failed(0, flavname);
} else if (conn->_base.purpose == DIR_PURPOSE_FETCH_CERTIFICATE) { } else if (conn->_base.purpose == DIR_PURPOSE_FETCH_CERTIFICATE) {
log_info(LD_DIR, "Giving up on certificate fetch from directory server " log_info(LD_DIR, "Giving up on certificate fetch from directory server "
"at '%s'; retrying", "at '%s'; retrying",
@ -1004,8 +1003,14 @@ directory_get_consensus_url(int supports_conditional_consensus,
const char *resource) const char *resource)
{ {
char *url = NULL; char *url = NULL;
const char *hyphen = resource ? "-" : ""; const char *hyphen, *flavor;
const char *flavor = resource ? resource : ""; if (resource==NULL || strcmp(resource, "ns")==0) {
flavor = ""; /* Request ns consensuses as "", so older servers will work*/
hyphen = "";
} else {
flavor = resource;
hyphen = "-";
}
if (supports_conditional_consensus) { if (supports_conditional_consensus) {
char *authority_id_list; char *authority_id_list;
@ -1746,8 +1751,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
if (conn->_base.purpose == DIR_PURPOSE_FETCH_CONSENSUS) { if (conn->_base.purpose == DIR_PURPOSE_FETCH_CONSENSUS) {
int r; int r;
const char *flavname = const char *flavname = conn->requested_resource;
conn->requested_resource ? conn->requested_resource : "ns";
if (status_code != 200) { if (status_code != 200) {
int severity = (status_code == 304) ? LOG_INFO : LOG_WARN; int severity = (status_code == 304) ? LOG_INFO : LOG_WARN;
log(severity, LD_DIR, log(severity, LD_DIR,

View File

@ -1217,7 +1217,7 @@ update_consensus_networkstatus_downloads(time_t now)
if (! we_want_to_fetch_flavor(options, i)) if (! we_want_to_fetch_flavor(options, i))
continue; continue;
resource = i==FLAV_NS ? NULL : networkstatus_get_flavor_name(i); resource = networkstatus_get_flavor_name(i);
if (!download_status_is_ready(&consensus_dl_status[i], now, if (!download_status_is_ready(&consensus_dl_status[i], now,
CONSENSUS_NETWORKSTATUS_MAX_DL_TRIES)) CONSENSUS_NETWORKSTATUS_MAX_DL_TRIES))