aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2019-04-03 17:59:46 +0300
committerGeorge Kadianakis <desnacked@riseup.net>2019-04-03 17:59:46 +0300
commit0b6769a99e4493a0b69fcbedda3febc6028391fb (patch)
tree8d244410440fc1a39df281c047f4902c10f907c0
parent50341bb5ba3e25b680b8b78b63debc8498112908 (diff)
parent42aae0e693be6f96eef9d124867c7e0915b6ab78 (diff)
downloadtor-0b6769a99e4493a0b69fcbedda3febc6028391fb.tar.gz
tor-0b6769a99e4493a0b69fcbedda3febc6028391fb.zip
Merge branch 'maint-0.4.0'
-rw-r--r--changes/ticket298973
-rw-r--r--src/feature/dircache/dircache.c5
2 files changed, 4 insertions, 4 deletions
diff --git a/changes/ticket29897 b/changes/ticket29897
new file mode 100644
index 0000000000..232a79fbce
--- /dev/null
+++ b/changes/ticket29897
@@ -0,0 +1,3 @@
+ o Code simplification and refactoring:
+ - Refactor handle_get_next_bandwidth() to use connection_dir_buf_add().
+ Implements ticket 29897.
diff --git a/src/feature/dircache/dircache.c b/src/feature/dircache/dircache.c
index a8649054a9..06bd298aca 100644
--- a/src/feature/dircache/dircache.c
+++ b/src/feature/dircache/dircache.c
@@ -1478,13 +1478,10 @@ handle_get_next_bandwidth(dir_connection_t *conn,
conn->compress_state = tor_compress_new(1, compress_method,
choose_compression_level(len/2));
log_debug(LD_DIR, "Compressing bandwidth file.");
- connection_buf_add_compress(bandwidth, len, conn, 0);
- /* Flush the compression state. */
- connection_buf_add_compress("", 0, conn, 1);
} else {
log_debug(LD_DIR, "Not compressing bandwidth file.");
- connection_buf_add(bandwidth, len, TO_CONN(conn));
}
+ connection_dir_buf_add((const char*)bandwidth, len, conn, 1);
tor_free(bandwidth);
return 0;
}