mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 22:58:50 +01:00
dircache: Refactor handle_get_next_bandwidth() to use connection_dir_buf_add()
Implements ticket 29897.
This commit is contained in:
parent
c2222ba169
commit
194b25f0c7
2 changed files with 4 additions and 4 deletions
3
changes/ticket29897
Normal file
3
changes/ticket29897
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
o Code simplification and refactoring:
|
||||||
|
- Refactor handle_get_next_bandwidth() to use connection_dir_buf_add().
|
||||||
|
Implements ticket 29897.
|
|
@ -1486,13 +1486,10 @@ handle_get_next_bandwidth(dir_connection_t *conn,
|
||||||
conn->compress_state = tor_compress_new(1, compress_method,
|
conn->compress_state = tor_compress_new(1, compress_method,
|
||||||
choose_compression_level(len/2));
|
choose_compression_level(len/2));
|
||||||
log_debug(LD_DIR, "Compressing bandwidth file.");
|
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 {
|
} else {
|
||||||
log_debug(LD_DIR, "Not compressing bandwidth file.");
|
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);
|
tor_free(bandwidth);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue