summaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-10-15 23:15:24 +0000
committerNick Mathewson <nickm@torproject.org>2007-10-15 23:15:24 +0000
commit3ad6dc0e2e91e094e082e767c71e6e1d91f5fca0 (patch)
treee0a42cb1c2dbd0f12509c7aad3292182c4c27887 /src/or/control.c
parent95f6265a790a1a56ff284bbc8eb55e56583dada3 (diff)
downloadtor-3ad6dc0e2e91e094e082e767c71e6e1d91f5fca0.tar.gz
tor-3ad6dc0e2e91e094e082e767c71e6e1d91f5fca0.zip
r15806@catbus: nickm | 2007-10-15 19:14:57 -0400
Implement v3 networkstatus client code. Remove v2 networkstatus client code, except as needed for caches to fetch and serve v2 networkstatues and the routers they list. svn:r11957
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 873d2f4b36..0764e5a9d3 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1609,33 +1609,38 @@ getinfo_helper_events(control_connection_t *control_conn,
check_whether_orport_reachable() ? 1 : 0,
check_whether_dirport_reachable() ? 1 : 0);
} else if (!strcmpstart(question, "status/version/")) {
- combined_version_status_t st;
int is_server = server_mode(get_options());
- char *recommended;
- recommended = compute_recommended_versions(time(NULL),
- !is_server, VERSION, &st);
+ networkstatus_vote_t *c = networkstatus_get_latest_consensus();
+ version_status_t status;
+ const char *recommended;
+ if (c) {
+ recommended = is_server ? c->server_versions : c->client_versions;
+ status = tor_version_is_obsolete(VERSION, recommended);
+ } else {
+ recommended = "?";
+ status = VS_UNKNOWN;
+ }
+
if (!strcmp(question, "status/version/recommended")) {
- *answer = recommended;
+ *answer = tor_strdup(recommended);
return 0;
}
- tor_free(recommended);
if (!strcmp(question, "status/version/current")) {
- switch (st.consensus)
+ switch (status)
{
case VS_RECOMMENDED: *answer = tor_strdup("recommended"); break;
case VS_OLD: *answer = tor_strdup("obsolete"); break;
case VS_NEW: *answer = tor_strdup("new"); break;
case VS_NEW_IN_SERIES: *answer = tor_strdup("new in series"); break;
case VS_UNRECOMMENDED: *answer = tor_strdup("unrecommended"); break;
+ case VS_UNKNOWN: *answer = tor_strdup("unknown"); break;
default: tor_fragile_assert();
}
- } else if (!strcmp(question, "status/version/num-versioning")) {
- char s[33];
- tor_snprintf(s, sizeof(s), "%d", st.n_versioning);
- *answer = tor_strdup(s);
- } else if (!strcmp(question, "status/version/num-concurring")) {
+ } else if (!strcmp(question, "status/version/num-versioning") ||
+ !strcmp(question, "status/version/num-concurring")) {
+ /*XXXX020 deprecate.*/
char s[33];
- tor_snprintf(s, sizeof(s), "%d", st.n_concurring);
+ tor_snprintf(s, sizeof(s), "%d", get_n_authorities(V3_AUTHORITY));
*answer = tor_strdup(s);
}
} else {