diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-09-08 21:28:45 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-09-08 21:28:45 +0000 |
commit | 9df4716ac354ade52f02cca8ae479fbc93eeb985 (patch) | |
tree | 8a9c5c7d2493f578156fe7c5127753598b4001d0 | |
parent | 4ce0e018481817343d6824a0208e440ff1193a75 (diff) | |
download | tor-9df4716ac354ade52f02cca8ae479fbc93eeb985.tar.gz tor-9df4716ac354ade52f02cca8ae479fbc93eeb985.zip |
make it work correctly when we download multiple network-status objects.
svn:r4952
-rw-r--r-- | src/or/directory.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 7f65c13f82..e3ae92cd71 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -889,6 +889,7 @@ connection_dir_client_reached_eof(connection_t *conn) if (conn->purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS) { smartlist_t *which = NULL; + char *cp; log_fn(LOG_INFO,"Received networkstatus objects (size %d) from server '%s:%d'",(int) body_len, conn->address, conn->port); if (status_code != 200) { log_fn(LOG_WARN,"Received http status code %d (\"%s\") from server '%s:%d'. Failing.", @@ -901,14 +902,17 @@ connection_dir_client_reached_eof(connection_t *conn) which = smartlist_create(); smartlist_split_string(which, conn->requested_resource+3, "+", 0, -1); } - while (*body) { - char *next = strstr(body, "\nnetwork-status-version"); + cp = body; + while (*cp) { + char *next = strstr(cp, "\nnetwork-status-version"); if (next) - *next = '\0'; - if (router_set_networkstatus(body, time(NULL), NS_FROM_DIR, which)<0) + next[1] = '\0'; + if (router_set_networkstatus(cp, time(NULL), NS_FROM_DIR, which)<0) break; - if (next) - body = next+1; + if (next) { + next[1] = 'n'; + cp = next+1; + } else break; } |