mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-14 07:03:44 +01:00
Ah. We need a new zlib_state for each networkstatus we spool out.
svn:r6667
This commit is contained in:
parent
ed2fb517d3
commit
a9e1a4c33c
@ -1870,7 +1870,6 @@ connection_dirserv_add_dir_bytes_to_outbuf(connection_t *conn)
|
|||||||
conn->cached_dir_offset += bytes;
|
conn->cached_dir_offset += bytes;
|
||||||
if (conn->cached_dir_offset == (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. */
|
/* We just wrote the last one; finish up. */
|
||||||
if (conn->dir_spool_src == DIR_SPOOL_CACHED_DIR)
|
|
||||||
connection_dirserv_finish_spooling(conn);
|
connection_dirserv_finish_spooling(conn);
|
||||||
cached_dir_decref(conn->cached_dir);
|
cached_dir_decref(conn->cached_dir);
|
||||||
conn->cached_dir = NULL;
|
conn->cached_dir = NULL;
|
||||||
@ -1878,14 +1877,21 @@ connection_dirserv_add_dir_bytes_to_outbuf(connection_t *conn)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC */
|
||||||
static int
|
static int
|
||||||
connection_dirserv_add_networkstatus_bytes_to_outbuf(connection_t *conn)
|
connection_dirserv_add_networkstatus_bytes_to_outbuf(connection_t *conn)
|
||||||
{
|
{
|
||||||
int r;
|
|
||||||
while (buf_datalen(conn->outbuf) < DIRSERV_BUFFER_MIN) {
|
while (buf_datalen(conn->outbuf) < DIRSERV_BUFFER_MIN) {
|
||||||
if (conn->cached_dir) {
|
if (conn->cached_dir) {
|
||||||
if ((r = connection_dirserv_add_dir_bytes_to_outbuf(conn)))
|
int uncompressing = (conn->zlib_state != NULL);
|
||||||
return r;
|
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 = conn->zlib_state = tor_zlib_new(0, ZLIB_METHOD);
|
||||||
|
if (r) return r;
|
||||||
} else if (conn->fingerprint_stack &&
|
} else if (conn->fingerprint_stack &&
|
||||||
smartlist_len(conn->fingerprint_stack)) {
|
smartlist_len(conn->fingerprint_stack)) {
|
||||||
/* Add another networkstatus; start serving it. */
|
/* Add another networkstatus; start serving it. */
|
||||||
|
Loading…
Reference in New Issue
Block a user