aboutsummaryrefslogtreecommitdiff
path: root/src/or/dirserv.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/dirserv.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/dirserv.c')
-rw-r--r--src/or/dirserv.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 72e1694db6..b1ea8cf84b 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1079,6 +1079,9 @@ static cached_dir_t cached_runningrouters = { NULL, NULL, 0, 0, 0, -1 };
* cached_dir_t. */
static digestmap_t *cached_v2_networkstatus = NULL;
+/** DOCDOC */
+static cached_dir_t *cached_v3_networkstatus = NULL;
+
/** Possibly replace the contents of <b>d</b> with the value of
* <b>directory</b> published on <b>when</b>, unless <b>when</b> is older than
* the last value, or too far in the future.
@@ -1245,6 +1248,17 @@ dirserv_set_cached_networkstatus_v2(const char *networkstatus,
}
}
+/* DOCDOC */
+void
+dirserv_set_cached_networkstatus_v3(const char *networkstatus,
+ time_t published)
+{
+ if (cached_v3_networkstatus)
+ cached_dir_decref(cached_v3_networkstatus);
+ cached_v3_networkstatus = new_cached_dir(
+ tor_strdup(networkstatus), published);
+}
+
/** Remove any v2 networkstatus from the directory cache that was published
* before <b>cutoff</b>. */
void
@@ -1446,6 +1460,12 @@ dirserv_get_runningrouters(void)
"v1 network status list", V1_AUTHORITY);
}
+cached_dir_t *
+dirserv_get_consensus(void)
+{
+ return cached_v3_networkstatus;
+}
+
/** For authoritative directories: the current (v2) network status. */
static cached_dir_t *the_v2_networkstatus = NULL;
@@ -2909,7 +2929,9 @@ connection_dirserv_add_networkstatus_bytes_to_outbuf(dir_connection_t *conn)
/* Add another networkstatus; start serving it. */
char *fp = smartlist_pop_last(conn->fingerprint_stack);
cached_dir_t *d;
- if (router_digest_is_me(fp))
+ if (tor_digest_is_zero(fp)) /* XXXX020 document this "feature". */
+ d = cached_v3_networkstatus;
+ else if (router_digest_is_me(fp))
d = the_v2_networkstatus;
else
d = digestmap_get(cached_v2_networkstatus, fp);