Become capable of noticing that we are done sending a directory.

svn:r6659
This commit is contained in:
Nick Mathewson 2006-06-18 20:58:27 +00:00
parent 5c0d7fb016
commit f1993b8b30

View File

@ -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);