aboutsummaryrefslogtreecommitdiff
path: root/src/or/routerparse.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@fscked.org>2010-02-14 17:49:08 -0800
committerMike Perry <mikeperry-git@fscked.org>2010-02-22 16:52:11 -0800
commit87a0430a74800ced173bd83215921101b3ac3653 (patch)
treeb806b054779ddcf1f7f9856ea9be11b4033e27de /src/or/routerparse.c
parent931e073a4fe41909a35fac3659cd48d55f044817 (diff)
downloadtor-87a0430a74800ced173bd83215921101b3ac3653.tar.gz
tor-87a0430a74800ced173bd83215921101b3ac3653.zip
Clearly mark directory footer so we parse the new weight line.
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 1212907e4e..082bf2ef0c 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -1870,22 +1870,30 @@ authority_cert_parse_from_string(const char *s, const char **end_of_string)
/** Helper: given a string <b>s</b>, return the start of the next router-status
* object (starting with "r " at the start of a line). If none is found,
- * return the start of the next directory signature. If none is found, return
- * the end of the string. */
+ * return the start of the directory footer, or the next directory signature.
+ * If none is found, return the end of the string. */
static INLINE const char *
find_start_of_next_routerstatus(const char *s)
{
const char *eos = strstr(s, "\nr ");
if (eos) {
- const char *eos2 = tor_memstr(s, eos-s, "\ndirectory-signature");
+ const char *eos2 = tor_memstr(s, eos-s, "\ndirectory-footer\n");
+ if (eos2) eos2 += strlen("\ndirectory-footer");
+ else eos2 = tor_memstr(s, eos-s, "\ndirectory-signature");
+ /* Technically we are returning either the start of the next
+ * routerstatus AFTER the \n, or the start of the next consensus
+ * line AT the \n. This seems asymmetric, but leaving it that way
+ * for now for stability. */
if (eos2 && eos2 < eos)
return eos2;
else
return eos+1;
} else {
+ if ((eos = strstr(s, "\ndirectory-footer\n")))
+ return eos+strlen("\ndirectory-footer\n");
if ((eos = strstr(s, "\ndirectory-signature")))
return eos+1;
- return s + strlen(s);
+ return s + strlen(s);
}
}