summaryrefslogtreecommitdiff
path: root/src/or/routerlist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-07-29 23:11:44 +0000
committerNick Mathewson <nickm@torproject.org>2007-07-29 23:11:44 +0000
commit77508edd3636110b4c8c20af9cfe457312e77afe (patch)
tree2021e04ef0cb6ee3a7f4dbf47cf1a74cc99232fd /src/or/routerlist.c
parent759ed3ce3f1de0911f25ad1e3a8016e01d3272a6 (diff)
downloadtor-77508edd3636110b4c8c20af9cfe457312e77afe.tar.gz
tor-77508edd3636110b4c8c20af9cfe457312e77afe.zip
r13989@catbus: nickm | 2007-07-29 19:11:07 -0400
More directory voting code. Now, if everything works, and I haven't forgotten anything, it is possible to set up some v3 authorities and start voting. Of course, I have probably forgotten something, and there are probably bugs in there somewhere too. svn:r10976
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r--src/or/routerlist.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 24c01a0b3a..88964611ba 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -3832,6 +3832,32 @@ networkstatus_get_live_consensus(time_t now)
return current_consensus;
}
+int
+networkstatus_set_current_consensus(const char *consensus)
+{
+ networkstatus_vote_t *c;
+ /* Make sure it's parseable. */
+ c = networkstatus_parse_vote_from_string(consensus, 0);
+ if (!c)
+ return -1;
+
+ /* Make sure it's signed enough. */
+ if (networkstatus_check_consensus_signature(c)<0) {
+ networkstatus_vote_free(c);
+ return -1;
+ }
+
+ if (current_consensus)
+ networkstatus_vote_free(current_consensus);
+
+ current_consensus = c;
+
+ if (get_options()->DirPort)
+ dirserv_set_cached_networkstatus_v3(consensus, c->valid_after);
+
+ return 0;
+}
+
/** We believe networkstatuses more recent than this when they tell us that
* our server is broken, invalid, obsolete, etc. */
#define SELF_OPINION_INTERVAL (90*60)