diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-04-25 08:12:59 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-04-25 08:12:59 -0400 |
commit | ba405f86bf33ed0e6c9552b3d9aad87bb79c1237 (patch) | |
tree | 4f50dd06a62263594e69c701253d4a632d1c7574 /src/or/dirserv.c | |
parent | db95a6e17129b51e0409dbcad1707367f9388173 (diff) | |
parent | 2210b330e757d234346191e5d05af761fe8561e6 (diff) | |
download | tor-ba405f86bf33ed0e6c9552b3d9aad87bb79c1237.tar.gz tor-ba405f86bf33ed0e6c9552b3d9aad87bb79c1237.zip |
Merge branch 'ahf_prop278_21662_squashed'
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r-- | src/or/dirserv.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 70b0b22f25..e76fd932ca 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -1176,8 +1176,8 @@ new_cached_dir(char *s, time_t published) d->dir = s; d->dir_len = strlen(s); d->published = published; - if (tor_gzip_compress(&(d->dir_z), &(d->dir_z_len), d->dir, d->dir_len, - ZLIB_METHOD)) { + if (tor_compress(&(d->dir_z), &(d->dir_z_len), d->dir, d->dir_len, + ZLIB_METHOD)) { log_warn(LD_BUG, "Error compressing directory"); } return d; @@ -3497,8 +3497,8 @@ spooled_resource_flush_some(spooled_resource_t *spooled, /* Absent objects count as "done". */ return SRFS_DONE; } - if (conn->zlib_state) { - connection_write_to_buf_zlib((const char*)body, bodylen, conn, 0); + if (conn->compress_state) { + connection_write_to_buf_compress((const char*)body, bodylen, conn, 0); } else { connection_write_to_buf((const char*)body, bodylen, TO_CONN(conn)); } @@ -3523,9 +3523,10 @@ spooled_resource_flush_some(spooled_resource_t *spooled, if (BUG(remaining < 0)) return SRFS_ERR; ssize_t bytes = (ssize_t) MIN(DIRSERV_CACHED_DIR_CHUNK_SIZE, remaining); - if (conn->zlib_state) { - connection_write_to_buf_zlib(cached->dir_z + spooled->cached_dir_offset, - bytes, conn, 0); + if (conn->compress_state) { + connection_write_to_buf_compress( + cached->dir_z + spooled->cached_dir_offset, + bytes, conn, 0); } else { connection_write_to_buf(cached->dir_z + spooled->cached_dir_offset, bytes, TO_CONN(conn)); @@ -3788,12 +3789,12 @@ connection_dirserv_flushed_some(dir_connection_t *conn) /* If we get here, we're done. */ smartlist_free(conn->spool); conn->spool = NULL; - if (conn->zlib_state) { - /* Flush the zlib state: there could be more bytes pending in there, and - * we don't want to omit bytes. */ - connection_write_to_buf_zlib("", 0, conn, 1); - tor_zlib_free(conn->zlib_state); - conn->zlib_state = NULL; + if (conn->compress_state) { + /* Flush the compression state: there could be more bytes pending in there, + * and we don't want to omit bytes. */ + connection_write_to_buf_compress("", 0, conn, 1); + tor_compress_free(conn->compress_state); + conn->compress_state = NULL; } return 0; } |