summaryrefslogtreecommitdiff
path: root/src/or/networkstatus.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-07-01 15:29:05 -0400
committerNick Mathewson <nickm@torproject.org>2016-07-01 15:29:05 -0400
commitaaa31290431ea2cd1d1e8498dbe271eb53d2389d (patch)
treed7ff38ffee26c5ab4571f089e8cf06d9e687a14c /src/or/networkstatus.c
parent738a8c655a1f8067b330b132164fa8879ef102c3 (diff)
parent36e201dffc5d57d92113e1e68ad4b6a0a7b3471e (diff)
downloadtor-aaa31290431ea2cd1d1e8498dbe271eb53d2389d.tar.gz
tor-aaa31290431ea2cd1d1e8498dbe271eb53d2389d.zip
Merge remote-tracking branch 'dgoulet/ticket16943_029_05-squashed'
Trivial Conflicts: src/or/or.h src/or/routerparse.c
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r--src/or/networkstatus.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 5415c30289..0dfb8afcce 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -32,7 +32,9 @@
#include "router.h"
#include "routerlist.h"
#include "routerparse.h"
+#include "shared_random.h"
#include "transports.h"
+#include "torcert.h"
/** Map from lowercase nickname to identity digest of named server, if any. */
static strmap_t *named_server_map = NULL;
@@ -320,6 +322,14 @@ networkstatus_vote_free(networkstatus_t *ns)
digestmap_free(ns->desc_digest_map, NULL);
+ if (ns->sr_info.commits) {
+ SMARTLIST_FOREACH(ns->sr_info.commits, sr_commit_t *, c,
+ sr_commit_free(c));
+ smartlist_free(ns->sr_info.commits);
+ }
+ tor_free(ns->sr_info.previous_srv);
+ tor_free(ns->sr_info.current_srv);
+
memwipe(ns, 11, sizeof(*ns));
tor_free(ns);
}
@@ -1264,8 +1274,8 @@ networkstatus_get_dl_status_by_flavor_running,(consensus_flavor_t flavor))
/** Return the most recent consensus that we have downloaded, or NULL if we
* don't have one. */
-networkstatus_t *
-networkstatus_get_latest_consensus(void)
+MOCK_IMPL(networkstatus_t *,
+networkstatus_get_latest_consensus,(void))
{
return current_consensus;
}
@@ -1287,8 +1297,8 @@ networkstatus_get_latest_consensus_by_flavor,(consensus_flavor_t f))
/** Return the most recent consensus that we have downloaded, or NULL if it is
* no longer live. */
-networkstatus_t *
-networkstatus_get_live_consensus(time_t now)
+MOCK_IMPL(networkstatus_t *,
+networkstatus_get_live_consensus,(time_t now))
{
if (current_consensus &&
current_consensus->valid_after <= now &&