diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-12-17 13:18:00 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-12-17 13:18:00 -0500 |
commit | adfcc1da4aac9766274275460fe2252bd9ffe4eb (patch) | |
tree | 9e4e7227f5f076f322990ee1c2e25fc8491d3eca /src/or | |
parent | e6590efaa77c8cf186ce92e6ebad175e9c6450d1 (diff) | |
parent | 3d5154550c92766347631e4d15fae825a0f165dd (diff) | |
download | tor-adfcc1da4aac9766274275460fe2252bd9ffe4eb.tar.gz tor-adfcc1da4aac9766274275460fe2252bd9ffe4eb.zip |
Merge remote-tracking branch 'origin/maint-0.2.4'
Conflicts:
src/or/microdesc.c
Conflict because one change was on line adjacent to line where
01206893 got fixed.
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/dirvote.c | 3 | ||||
-rw-r--r-- | src/or/microdesc.c | 3 | ||||
-rw-r--r-- | src/or/routerparse.c | 13 | ||||
-rw-r--r-- | src/or/routerparse.h | 2 |
4 files changed, 14 insertions, 7 deletions
diff --git a/src/or/dirvote.c b/src/or/dirvote.c index 456a033ec9..4d3ee9cdb3 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -3592,7 +3592,8 @@ dirvote_create_microdescriptor(const routerinfo_t *ri, int consensus_method) { smartlist_t *lst = microdescs_parse_from_string(output, - output+strlen(output), 0, 1); + output+strlen(output), 0, + SAVED_NOWHERE); if (smartlist_len(lst) != 1) { log_warn(LD_DIR, "We generated a microdescriptor we couldn't parse."); SMARTLIST_FOREACH(lst, microdesc_t *, md, microdesc_free(md)); diff --git a/src/or/microdesc.c b/src/or/microdesc.c index 7765d27da6..2bf6f54ab6 100644 --- a/src/or/microdesc.c +++ b/src/or/microdesc.c @@ -154,11 +154,10 @@ microdescs_add_to_cache(microdesc_cache_t *cache, { smartlist_t *descriptors, *added; const int allow_annotations = (where != SAVED_NOWHERE); - const int copy_body = (where != SAVED_IN_CACHE); descriptors = microdescs_parse_from_string(s, eos, allow_annotations, - copy_body); + where); if (listed_at != (time_t)-1) { SMARTLIST_FOREACH(descriptors, microdesc_t *, md, md->last_listed = listed_at); diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 6d837159e1..571167fad0 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -4240,12 +4240,17 @@ find_start_of_next_microdesc(const char *s, const char *eos) /** Parse as many microdescriptors as are found from the string starting at * <b>s</b> and ending at <b>eos</b>. If allow_annotations is set, read any - * annotations we recognize and ignore ones we don't. If <b>copy_body</b> is - * true, then strdup the bodies of the microdescriptors. Return all newly + * annotations we recognize and ignore ones we don't. + * + * If <b>saved_location</b> isn't SAVED_IN_CACHE, make a local copy of each + * descriptor in the body field of each microdesc_t. + * + * Return all newly * parsed microdescriptors in a newly allocated smartlist_t. */ smartlist_t * microdescs_parse_from_string(const char *s, const char *eos, - int allow_annotations, int copy_body) + int allow_annotations, + saved_location_t where) { smartlist_t *tokens; smartlist_t *result; @@ -4254,6 +4259,7 @@ microdescs_parse_from_string(const char *s, const char *eos, const char *start = s; const char *start_of_next_microdesc; int flags = allow_annotations ? TS_ANNOTATIONS_OK : 0; + const int copy_body = (where != SAVED_IN_CACHE); directory_token_t *tok; @@ -4283,6 +4289,7 @@ microdescs_parse_from_string(const char *s, const char *eos, tor_assert(cp); md->bodylen = start_of_next_microdesc - cp; + md->saved_location = where; if (copy_body) md->body = tor_memdup_nulterm(cp, md->bodylen); else diff --git a/src/or/routerparse.h b/src/or/routerparse.h index c65cdc996c..eb2e885cb1 100644 --- a/src/or/routerparse.h +++ b/src/or/routerparse.h @@ -64,7 +64,7 @@ ns_detached_signatures_t *networkstatus_parse_detached_signatures( smartlist_t *microdescs_parse_from_string(const char *s, const char *eos, int allow_annotations, - int copy_body); + saved_location_t where); authority_cert_t *authority_cert_parse_from_string(const char *s, const char **end_of_string); |