]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
dircache: Refactor handle_get_next_bandwidth() to use connection_dir_buf_add()
authorteor <teor@torproject.org>
Tue, 26 Mar 2019 08:12:16 +0000 (18:12 +1000)
committerteor <teor@torproject.org>
Fri, 29 Mar 2019 07:26:30 +0000 (17:26 +1000)
Implements ticket 29897.

changes/ticket29897 [new file with mode: 0644]
src/feature/dircache/dircache.c

diff --git a/changes/ticket29897 b/changes/ticket29897
new file mode 100644 (file)
index 0000000..232a79f
--- /dev/null
@@ -0,0 +1,3 @@
+  o Code simplification and refactoring:
+    - Refactor handle_get_next_bandwidth() to use connection_dir_buf_add().
+      Implements ticket 29897.
index caa085dd6370cef4ca7ac688be35cb7f55af7f8e..62eb4c86c21365697da4591f667b3970b4bd560e 100644 (file)
@@ -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;
     }