[or-cvs] Fix bug in networkstatus spooling: spool more than the firs...

Nick Mathewson nickm at seul.org
Tue Jun 20 23:06:55 UTC 2006


Update of /home/or/cvsroot/tor/src/or
In directory moria:/home/nickm/src/tor/src/or

Modified Files:
	dirserv.c 
Log Message:
Fix bug in networkstatus spooling: spool more than the first networkstatus.

Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.345
retrieving revision 1.346
diff -u -p -d -r1.345 -r1.346
--- dirserv.c	20 Jun 2006 16:48:32 -0000	1.345
+++ dirserv.c	20 Jun 2006 23:06:52 -0000	1.346
@@ -1886,11 +1886,20 @@ connection_dirserv_add_networkstatus_byt
     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)) {



More information about the tor-commits mailing list