summaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-06-20 23:06:52 +0000
committerNick Mathewson <nickm@torproject.org>2006-06-20 23:06:52 +0000
commit0799154ae11ef2fff410cf6c4162fc7ecbc7d436 (patch)
tree407a495e4d77745db33b5194e0815e4558de0faf /src/or/dirserv.c
parent0e09b261122a4ef22dccbe212775e5142880183b (diff)
downloadtor-0799154ae11ef2fff410cf6c4162fc7ecbc7d436.tar.gz
tor-0799154ae11ef2fff410cf6c4162fc7ecbc7d436.zip
Fix bug in networkstatus spooling: spool more than the first networkstatus.
svn:r6670
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 7c2d74bebe..c44532723f 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1886,11 +1886,20 @@ connection_dirserv_add_networkstatus_bytes_to_outbuf(connection_t *conn)
if (conn->cached_dir) {
int uncompressing = (conn->zlib_state != NULL);
int r = connection_dirserv_add_dir_bytes_to_outbuf(conn);
- /* This bit is tricky. If we were uncompressing the last networkstatus,
- * we may need to make a new zlib object to uncompress the next one. */
- if (uncompressing && ! conn->zlib_state &&
- conn->fingerprint_stack && smartlist_len(conn->fingerprint_stack))
- conn->zlib_state = tor_zlib_new(0, ZLIB_METHOD);
+ if (conn->dir_spool_src == DIR_SPOOL_NONE) {
+ /* add_dir_bytes thinks we're done with the cached_dir. But we
+ * may have more cached_dirs! */
+ conn->dir_spool_src = DIR_SPOOL_NETWORKSTATUS;
+ /* This bit is tricky. If we were uncompressing the last
+ * networkstatus, we may need to make a new zlib object to
+ * uncompress the next one. */
+ if (uncompressing && ! conn->zlib_state &&
+ conn->fingerprint_stack &&
+ smartlist_len(conn->fingerprint_stack)) {
+ log_notice(LD_GENERAL, "New zlib buf.");
+ conn->zlib_state = tor_zlib_new(0, ZLIB_METHOD);
+ }
+ }
if (r) return r;
} else if (conn->fingerprint_stack &&
smartlist_len(conn->fingerprint_stack)) {