From c2222ba169a059e1a6ce04cb9014fe8870674d87 Mon Sep 17 00:00:00 2001 From: rl1987 Date: Sat, 9 Feb 2019 16:56:54 +0200 Subject: Add changes file --- changes/ticket28816 | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changes/ticket28816 (limited to 'changes') diff --git a/changes/ticket28816 b/changes/ticket28816 new file mode 100644 index 0000000000..02878ccfdc --- /dev/null +++ b/changes/ticket28816 @@ -0,0 +1,4 @@ + o Code simplification and refactoring: + - Introduce a connection_dir_buf_add() helper function that checks for + compress_state of dir_connection_t and automatically writes a string to + directory connection with or without compression. Resolves issue 28816. -- cgit v1.2.3-54-g00ecf From 194b25f0c7043b2485bb90da6fb24c0e96957875 Mon Sep 17 00:00:00 2001 From: teor Date: Tue, 26 Mar 2019 18:12:16 +1000 Subject: dircache: Refactor handle_get_next_bandwidth() to use connection_dir_buf_add() Implements ticket 29897. --- changes/ticket29897 | 3 +++ src/feature/dircache/dircache.c | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 changes/ticket29897 (limited to 'changes') 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 caa085dd63..62eb4c86c2 100644 --- a/src/feature/dircache/dircache.c +++ b/src/feature/dircache/dircache.c @@ -1486,13 +1486,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; } -- cgit v1.2.3-54-g00ecf