diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-01-24 13:49:15 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-01-24 13:53:56 -0500 |
commit | 92496a739aac44a537ee9062a4f0d71fba023156 (patch) | |
tree | d7f3c71ef5ad8e7c773e23b529ad64b7ca84cf02 /src/or/routerparse.c | |
parent | 7792be2d446a35ad71d0c67fb762f868ae07b99c (diff) | |
download | tor-92496a739aac44a537ee9062a4f0d71fba023156.tar.gz tor-92496a739aac44a537ee9062a4f0d71fba023156.zip |
Also cache the protover summary in the routerinfo_t, if we're using that
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r-- | src/or/routerparse.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 1cbbb17283..54759c9a7b 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -379,6 +379,10 @@ static int check_signature_token(const char *digest, int flags, const char *doctype); +static void summarize_protover_flags(protover_summary_flags_t *out, + const char *protocols, + const char *version); + #undef DEBUG_AREA_ALLOC #ifdef DEBUG_AREA_ALLOC @@ -1895,12 +1899,19 @@ router_parse_entry_from_string(const char *s, const char *end, } } - if ((tok = find_opt_by_keyword(tokens, K_PLATFORM))) { - router->platform = tor_strdup(tok->args[0]); - } + { + const char *version = NULL, *protocols = NULL; + if ((tok = find_opt_by_keyword(tokens, K_PLATFORM))) { + router->platform = tor_strdup(tok->args[0]); + version = tok->args[0]; + } + + if ((tok = find_opt_by_keyword(tokens, K_PROTO))) { + router->protocol_list = tor_strdup(tok->args[0]); + protocols = tok->args[0]; + } - if ((tok = find_opt_by_keyword(tokens, K_PROTO))) { - router->protocol_list = tor_strdup(tok->args[0]); + summarize_protover_flags(&router->pv, protocols, version); } if ((tok = find_opt_by_keyword(tokens, K_CONTACT))) { |