Commit 6fdc63ae authored by Roger Dingledine's avatar Roger Dingledine
Browse files

simplify the connection_write_to_buf_zlib() wrapper.


svn:r7042
parent 6410baf6
......@@ -1696,7 +1696,6 @@ connection_write_to_buf(const char *string, size_t len, connection_t *conn)
void
connection_write_to_buf_zlib(dir_connection_t *dir_conn,
tor_zlib_state_t *state,
const char *data, size_t data_len,
int done)
{
......@@ -1713,8 +1712,8 @@ connection_write_to_buf_zlib(dir_connection_t *dir_conn,
old_datalen = buf_datalen(conn->outbuf);
/* XXXX TOO much duplicate code! XXXX012NM */
CONN_LOG_PROTECT(conn, r = write_to_buf_zlib(
conn->outbuf, state, data, data_len,
done));
conn->outbuf, dir_conn->zlib_state,
data, data_len, done));
if (r < 0) {
log_warn(LD_NET,
"write_to_buf failed. Closing connection (fd %d).", conn->s);
......
......@@ -1829,7 +1829,7 @@ static int
connection_dirserv_finish_spooling(dir_connection_t *conn)
{
if (conn->zlib_state) {
connection_write_to_buf_zlib(conn, conn->zlib_state, "", 0, 1);
connection_write_to_buf_zlib(conn, "", 0, 1);
tor_zlib_free(conn->zlib_state);
conn->zlib_state = NULL;
}
......@@ -1865,10 +1865,8 @@ connection_dirserv_add_servers_to_outbuf(dir_connection_t *conn)
body = signed_descriptor_get_body(sd);
if (conn->zlib_state) {
int last = ! smartlist_len(conn->fingerprint_stack);
connection_write_to_buf_zlib(
conn, conn->zlib_state,
body, sd->signed_descriptor_len,
last);
connection_write_to_buf_zlib(conn, body,
sd->signed_descriptor_len, last);
if (last) {
tor_zlib_free(conn->zlib_state);
conn->zlib_state = NULL;
......@@ -1905,7 +1903,7 @@ connection_dirserv_add_dir_bytes_to_outbuf(dir_connection_t *conn)
bytes = remaining;
if (conn->zlib_state) {
connection_write_to_buf_zlib(conn, conn->zlib_state,
connection_write_to_buf_zlib(conn,
conn->cached_dir->dir_z + conn->cached_dir_offset,
bytes, bytes == remaining);
} else {
......
......@@ -1836,7 +1836,6 @@ void _connection_controller_force_write(control_connection_t *conn);
void connection_write_to_buf(const char *string, size_t len,
connection_t *conn);
void connection_write_to_buf_zlib(dir_connection_t *conn,
tor_zlib_state_t *state,
const char *data, size_t data_len,
int done);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment