aboutsummaryrefslogtreecommitdiff
path: root/src/or/routerparse.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-02-25 20:46:13 +0000
committerNick Mathewson <nickm@torproject.org>2005-02-25 20:46:13 +0000
commitbbaa3c7792792d9899ed36d9b0db4703c617a7a3 (patch)
treef0d37ff02bafecbad300710532f6e847cb3d8756 /src/or/routerparse.c
parentd21f007a8465b7c04d4ea8084501a588af4874a6 (diff)
downloadtor-bbaa3c7792792d9899ed36d9b0db4703c617a7a3.tar
tor-bbaa3c7792792d9899ed36d9b0db4703c617a7a3.tar.gz
Implement more control spec functionality
- Mapaddress - Postdescriptor - GetInfo on descriptors Required changes elsewhere: - Keep the most recent running_routers_t in the routerlist_t. That way we can learn about new routers and remember whether we were last told that they were up or down. Also enables more simplifications. - Keep the signed descriptor inside routerinfo_t. This makes descriptor_entry_t in dirservers.c unneeded. - Rename AddressMap (the verb) to MapAddress. Keep AddressMap as a noun. - Check addresses for plausibility before mapping them. svn:r3696
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r--src/or/routerparse.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 0cb996c17..d4b5cba49 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -312,6 +312,7 @@ router_parse_routerlist_from_directory(const char *str,
char digest[DIGEST_LEN];
routerlist_t *new_dir = NULL;
char *versions = NULL;
+ int nickname_list_is_running_routers;
smartlist_t *good_nickname_list = NULL;
time_t published_on;
int i, r;
@@ -426,6 +427,7 @@ router_parse_routerlist_from_directory(const char *str,
}
}
+ nickname_list_is_running_routers = (tok->tp == K_RUNNING_ROUTERS);
good_nickname_list = smartlist_create();
for (i=0; i<tok->n_args; ++i) {
smartlist_add(good_nickname_list, tok->args[i]);
@@ -459,6 +461,11 @@ router_parse_routerlist_from_directory(const char *str,
new_dir->software_versions = versions; versions = NULL;
new_dir->published_on = published_on;
+ new_dir->running_routers = tor_malloc_zero(sizeof(running_routers_t));
+ new_dir->running_routers->published_on = published_on;
+ new_dir->running_routers->running_routers = good_nickname_list;
+ new_dir->running_routers->is_running_routers_format =
+ nickname_list_is_running_routers;
SMARTLIST_FOREACH(tokens, directory_token_t *, tok, token_free(tok));
smartlist_free(tokens);
@@ -475,16 +482,16 @@ router_parse_routerlist_from_directory(const char *str,
if (new_dir)
routerlist_free(new_dir);
tor_free(versions);
+ if (good_nickname_list) {
+ SMARTLIST_FOREACH(good_nickname_list, char *, n, tor_free(n));
+ smartlist_free(good_nickname_list);
+ }
done:
if (declared_key) crypto_free_pk_env(declared_key);
if (tokens) {
SMARTLIST_FOREACH(tokens, directory_token_t *, tok, token_free(tok));
smartlist_free(tokens);
}
- if (good_nickname_list) {
- SMARTLIST_FOREACH(good_nickname_list, char *, n, tor_free(n));
- smartlist_free(good_nickname_list);
- }
return r;
}
@@ -802,6 +809,7 @@ routerinfo_t *router_parse_entry_from_string(const char *s,
}
router = tor_malloc_zero(sizeof(routerinfo_t));
+ router->signed_descriptor = tor_strndup(s, end-s);
ports_set = bw_set = 0;
if (tok->n_args == 2 || tok->n_args == 5 || tok->n_args == 6) {