From 6fdc63aed29dd727524339e4c8a5537e9930149a Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Sun, 13 Aug 2006 23:38:30 +0000 Subject: [PATCH] simplify the connection_write_to_buf_zlib() wrapper. svn:r7042 --- src/or/connection.c | 5 ++--- src/or/dirserv.c | 10 ++++------ src/or/or.h | 1 - 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/or/connection.c b/src/or/connection.c index e760e257f5..6fc68263ba 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -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); diff --git a/src/or/dirserv.c b/src/or/dirserv.c index ea8a0b512e..b2342be22e 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -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 { diff --git a/src/or/or.h b/src/or/or.h index fc2d3063a7..b07cec267b 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -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);