From f1993b8b30a937bf8958575e4309ae0e976c87b7 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 18 Jun 2006 20:58:27 +0000 Subject: [PATCH] Become capable of noticing that we are done sending a directory. svn:r6659 --- src/or/dirserv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 8788d2f215..2421d6ff98 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -1804,6 +1804,7 @@ connection_dirserv_add_dir_bytes_to_outbuf(connection_t *conn) bytes = DIRSERV_BUFFER_MIN - buf_datalen(conn->outbuf); tor_assert(bytes > 0); + tor_assert(conn->cached_dir); if (bytes < 8192) bytes = 8192; remaining = conn->cached_dir->dir_z_len - conn->cached_dir_offset; @@ -1819,7 +1820,7 @@ connection_dirserv_add_dir_bytes_to_outbuf(connection_t *conn) bytes, conn); } conn->cached_dir_offset += bytes; - if (bytes == (int)conn->cached_dir->dir_z_len) { + if (conn->cached_dir_offset == (int)conn->cached_dir->dir_z_len) { /* We just wrote the last one; finish up. */ if (conn->zlib_state) { connection_write_to_buf_zlib(conn, conn->zlib_state, "", 0, 1);