diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-01-31 13:47:01 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-01-31 13:47:01 -0500 |
commit | 0dc1595d0359dbf51ad24fe8bbadb5ab41fb9eb9 (patch) | |
tree | 7dc074e23102336db090c357d879cbe66db4e906 /src/or | |
parent | 2294e330bde259f6b575f301258783ce2947bdc0 (diff) | |
parent | 1c39d969b99b7825a0e2f2db67efb0c0e19d7002 (diff) | |
download | tor-0dc1595d0359dbf51ad24fe8bbadb5ab41fb9eb9.tar.gz tor-0dc1595d0359dbf51ad24fe8bbadb5ab41fb9eb9.zip |
Merge branch 'maint-0.3.2'
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/networkstatus.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 77898445d9..7ab80dde8f 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -1600,7 +1600,11 @@ notify_control_networkstatus_changed(const networkstatus_t *old_c, smartlist_free(changed); } -/* Called when the consensus has changed from old_c to new_c. */ +/* Called when the consensus has changed from old_c to new_c. + * + * IMPORTANT: This is called _after_ the new consensus has been set in the + * global state so this is safe for anything getting the latest consensus from + * that state. */ static void notify_networkstatus_changed(const networkstatus_t *old_c, const networkstatus_t *new_c) @@ -1934,9 +1938,6 @@ networkstatus_set_current_consensus(const char *consensus, const int is_usable_flavor = flav == usable_consensus_flavor(); - if (is_usable_flavor) { - notify_networkstatus_changed(networkstatus_get_latest_consensus(), c); - } if (flav == FLAV_NS) { if (current_ns_consensus) { networkstatus_copy_old_consensus_info(c, current_ns_consensus); @@ -1959,6 +1960,13 @@ networkstatus_set_current_consensus(const char *consensus, free_consensus = 0; /* avoid free */ } + /* Called _after_ the consensus is set in its global variable so any + * functions called from this notification can safely get the latest + * consensus being the new one. */ + if (is_usable_flavor) { + notify_networkstatus_changed(networkstatus_get_latest_consensus(), c); + } + waiting = &consensus_waiting_for_certs[flav]; if (waiting->consensus && waiting->consensus->valid_after <= c->valid_after) { |