summaryrefslogtreecommitdiff
path: root/src/or/networkstatus.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-09-15 12:00:50 -0400
committerNick Mathewson <nickm@torproject.org>2017-09-15 12:00:50 -0400
commit0f4f40b70fe6ea16a43940f86db767e1a16a4f6e (patch)
tree59ba8fa1332fa127ade5882da3836809bd540fea /src/or/networkstatus.c
parent962b0b849bf0c2fcca387e334985b349a255de0a (diff)
parent06500171434dca543e3daf74ce7033a0aef3d199 (diff)
downloadtor-0f4f40b70fe6ea16a43940f86db767e1a16a4f6e.tar.gz
tor-0f4f40b70fe6ea16a43940f86db767e1a16a4f6e.zip
Merge remote-tracking branch 'dgoulet/ticket12541_032_02'
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r--src/or/networkstatus.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 7953af1cc7..00d9222ef1 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -61,6 +61,7 @@
#include "router.h"
#include "routerlist.h"
#include "routerparse.h"
+#include "scheduler.h"
#include "shared_random.h"
#include "transports.h"
#include "torcert.h"
@@ -1561,6 +1562,15 @@ notify_control_networkstatus_changed(const networkstatus_t *old_c,
smartlist_free(changed);
}
+/* Called when the consensus has changed from old_c to new_c. */
+static void
+notify_networkstatus_changed(const networkstatus_t *old_c,
+ const networkstatus_t *new_c)
+{
+ notify_control_networkstatus_changed(old_c, new_c);
+ scheduler_notify_networkstatus_changed(old_c, new_c);
+}
+
/** Copy all the ancillary information (like router download status and so on)
* from <b>old_c</b> to <b>new_c</b>. */
static void
@@ -1886,8 +1896,7 @@ networkstatus_set_current_consensus(const char *consensus,
const int is_usable_flavor = flav == usable_consensus_flavor();
if (is_usable_flavor) {
- notify_control_networkstatus_changed(
- networkstatus_get_latest_consensus(), c);
+ notify_networkstatus_changed(networkstatus_get_latest_consensus(), c);
}
if (flav == FLAV_NS) {
if (current_ns_consensus) {
@@ -2314,9 +2323,9 @@ get_net_param_from_list(smartlist_t *net_params, const char *param_name,
* Make sure the value parsed from the consensus is at least
* <b>min_val</b> and at most <b>max_val</b> and raise/cap the parsed value
* if necessary. */
-int32_t
-networkstatus_get_param(const networkstatus_t *ns, const char *param_name,
- int32_t default_val, int32_t min_val, int32_t max_val)
+MOCK_IMPL(int32_t,
+networkstatus_get_param, (const networkstatus_t *ns, const char *param_name,
+ int32_t default_val, int32_t min_val, int32_t max_val))
{
if (!ns) /* if they pass in null, go find it ourselves */
ns = networkstatus_get_latest_consensus();