diff options
author | rl1987 <rl1987@sdf.lonestar.org> | 2019-02-09 16:46:31 +0200 |
---|---|---|
committer | rl1987 <rl1987@sdf.lonestar.org> | 2019-02-09 16:46:31 +0200 |
commit | 4c102213326705079be60d3ce335b81c94b76499 (patch) | |
tree | e150b8448b4901b53529263644e8b2c9c87f4ac2 /src/feature/dircache/dirserv.c | |
parent | 09a3c949f8388c83d4b62e281474687a26596a59 (diff) | |
download | tor-4c102213326705079be60d3ce335b81c94b76499.tar.gz tor-4c102213326705079be60d3ce335b81c94b76499.zip |
Use compress_dir_buf_add() function in a few places
Diffstat (limited to 'src/feature/dircache/dirserv.c')
-rw-r--r-- | src/feature/dircache/dirserv.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/feature/dircache/dirserv.c b/src/feature/dircache/dirserv.c index 4be6836fe1..79400bf15f 100644 --- a/src/feature/dircache/dirserv.c +++ b/src/feature/dircache/dirserv.c @@ -583,11 +583,9 @@ spooled_resource_flush_some(spooled_resource_t *spooled, /* Absent objects count as "done". */ return SRFS_DONE; } - if (conn->compress_state) { - connection_buf_add_compress((const char*)body, bodylen, conn, 0); - } else { - connection_buf_add((const char*)body, bodylen, TO_CONN(conn)); - } + + connection_dir_buf_add((const char*)body, bodylen, conn, 0); + return SRFS_DONE; } else { cached_dir_t *cached = spooled->cached_dir_ref; @@ -622,14 +620,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->compress_state) { - connection_buf_add_compress( - ptr + spooled->cached_dir_offset, - bytes, conn, 0); - } else { - connection_buf_add(ptr + spooled->cached_dir_offset, - bytes, TO_CONN(conn)); - } + + connection_dir_buf_add(ptr + spooled->cached_dir_offset, + bytes, conn, 0); + spooled->cached_dir_offset += bytes; if (spooled->cached_dir_offset >= (off_t)total_len) { return SRFS_DONE; |