aboutsummaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c27
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;
}