aboutsummaryrefslogtreecommitdiff
path: root/src/or/networkstatus.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-09-20 19:30:45 -0400
committerNick Mathewson <nickm@torproject.org>2016-09-20 19:30:45 -0400
commit62ee4f185f984f11d75522eedcee92d1f15fc7a6 (patch)
tree5da2395d73ec74fb0bcf7f7803975d1b5e110d8d /src/or/networkstatus.c
parent06d99aa2c42de6013b3fa55ac03c661f57f90047 (diff)
parent9ebe202da0c56ed6c006a0410a636a9e99d111f7 (diff)
downloadtor-62ee4f185f984f11d75522eedcee92d1f15fc7a6.tar.gz
tor-62ee4f185f984f11d75522eedcee92d1f15fc7a6.zip
Merge branch 'maint-0.2.8'
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r--src/or/networkstatus.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 72af505d19..28f5b42799 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -1733,7 +1733,9 @@ networkstatus_set_current_consensus(const char *consensus,
if (r != 1 && dl_certs)
authority_certs_fetch_missing(c, now, source_dir);
- if (flav == usable_consensus_flavor()) {
+ const int is_usable_flavor = flav == usable_consensus_flavor();
+
+ if (is_usable_flavor) {
notify_control_networkstatus_changed(current_consensus, c);
}
if (flav == FLAV_NS) {
@@ -1776,20 +1778,12 @@ networkstatus_set_current_consensus(const char *consensus,
}
}
- /* Reset the failure count only if this consensus is actually valid. */
- if (c->valid_after <= now && now <= c->valid_until) {
- download_status_reset(&consensus_dl_status[flav]);
- } else {
- if (!from_cache)
- download_status_failed(&consensus_dl_status[flav], 0);
- }
+ if (is_usable_flavor) {
+ nodelist_set_consensus(c);
- if (flav == usable_consensus_flavor()) {
/* XXXXNM Microdescs: needs a non-ns variant. ???? NM*/
update_consensus_networkstatus_fetch_time(now);
- nodelist_set_consensus(current_consensus);
-
dirvote_recalculate_timing(options, now);
routerstatus_list_update_named_server_map();
@@ -1813,6 +1807,14 @@ networkstatus_set_current_consensus(const char *consensus,
current_consensus);
}
+ /* Reset the failure count only if this consensus is actually valid. */
+ if (c->valid_after <= now && now <= c->valid_until) {
+ download_status_reset(&consensus_dl_status[flav]);
+ } else {
+ if (!from_cache)
+ download_status_failed(&consensus_dl_status[flav], 0);
+ }
+
if (directory_caches_dir_info(options)) {
dirserv_set_cached_consensus_networkstatus(consensus,
flavor,