aboutsummaryrefslogtreecommitdiff
path: root/src/feature/dircache/dircache.c
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2019-02-09 16:46:31 +0200
committerrl1987 <rl1987@sdf.lonestar.org>2019-02-09 16:46:31 +0200
commit4c102213326705079be60d3ce335b81c94b76499 (patch)
treee150b8448b4901b53529263644e8b2c9c87f4ac2 /src/feature/dircache/dircache.c
parent09a3c949f8388c83d4b62e281474687a26596a59 (diff)
downloadtor-4c102213326705079be60d3ce335b81c94b76499.tar.gz
tor-4c102213326705079be60d3ce335b81c94b76499.zip
Use compress_dir_buf_add() function in a few places
Diffstat (limited to 'src/feature/dircache/dircache.c')
-rw-r--r--src/feature/dircache/dircache.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/src/feature/dircache/dircache.c b/src/feature/dircache/dircache.c
index f6e57c5064..ee6e4f7a81 100644
--- a/src/feature/dircache/dircache.c
+++ b/src/feature/dircache/dircache.c
@@ -1068,13 +1068,11 @@ handle_get_status_vote(dir_connection_t *conn, const get_handler_args_t *args)
if (compress_method != NO_METHOD) {
conn->compress_state = tor_compress_new(1, compress_method,
choose_compression_level(estimated_len));
- SMARTLIST_FOREACH(items, const char *, c,
- connection_buf_add_compress(c, strlen(c), conn, 0));
- connection_buf_add_compress("", 0, conn, 1);
- } else {
- SMARTLIST_FOREACH(items, const char *, c,
- connection_buf_add(c, strlen(c), TO_CONN(conn)));
}
+
+ SMARTLIST_FOREACH(items, const char *, c,
+ connection_dir_buf_add(c, strlen(c), conn,
+ c_sl_idx == c_sl_len - 1));
} else {
SMARTLIST_FOREACH(dir_items, cached_dir_t *, d,
connection_buf_add(compress_method != NO_METHOD ?
@@ -1325,19 +1323,13 @@ handle_get_keys(dir_connection_t *conn, const get_handler_args_t *args)
if (compress_method != NO_METHOD) {
conn->compress_state = tor_compress_new(1, compress_method,
choose_compression_level(len));
- SMARTLIST_FOREACH(certs, authority_cert_t *, c,
- connection_buf_add_compress(
- c->cache_info.signed_descriptor_body,
- c->cache_info.signed_descriptor_len,
- conn, 0));
- connection_buf_add_compress("", 0, conn, 1);
- } else {
- SMARTLIST_FOREACH(certs, authority_cert_t *, c,
- connection_buf_add(c->cache_info.signed_descriptor_body,
- c->cache_info.signed_descriptor_len,
- TO_CONN(conn)));
}
- keys_done:
+
+ SMARTLIST_FOREACH(certs, authority_cert_t *, c,
+ connection_dir_buf_add(c->cache_info.signed_descriptor_body,
+ c->cache_info.signed_descriptor_len,
+ conn, c_sl_idx == c_sl_len - 1));
+ keys_done:
smartlist_free(certs);
goto done;
}