simplify the connection_write_to_buf_zlib() wrapper.

svn:r7042
This commit is contained in:
Roger Dingledine 2006-08-13 23:38:30 +00:00
parent 6410baf624
commit 6fdc63aed2
3 changed files with 6 additions and 10 deletions

View File

@ -1696,7 +1696,6 @@ connection_write_to_buf(const char *string, size_t len, connection_t *conn)
void void
connection_write_to_buf_zlib(dir_connection_t *dir_conn, connection_write_to_buf_zlib(dir_connection_t *dir_conn,
tor_zlib_state_t *state,
const char *data, size_t data_len, const char *data, size_t data_len,
int done) int done)
{ {
@ -1713,8 +1712,8 @@ connection_write_to_buf_zlib(dir_connection_t *dir_conn,
old_datalen = buf_datalen(conn->outbuf); old_datalen = buf_datalen(conn->outbuf);
/* XXXX TOO much duplicate code! XXXX012NM */ /* XXXX TOO much duplicate code! XXXX012NM */
CONN_LOG_PROTECT(conn, r = write_to_buf_zlib( CONN_LOG_PROTECT(conn, r = write_to_buf_zlib(
conn->outbuf, state, data, data_len, conn->outbuf, dir_conn->zlib_state,
done)); data, data_len, done));
if (r < 0) { if (r < 0) {
log_warn(LD_NET, log_warn(LD_NET,
"write_to_buf failed. Closing connection (fd %d).", conn->s); "write_to_buf failed. Closing connection (fd %d).", conn->s);

View File

@ -1829,7 +1829,7 @@ static int
connection_dirserv_finish_spooling(dir_connection_t *conn) connection_dirserv_finish_spooling(dir_connection_t *conn)
{ {
if (conn->zlib_state) { 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); tor_zlib_free(conn->zlib_state);
conn->zlib_state = NULL; conn->zlib_state = NULL;
} }
@ -1865,10 +1865,8 @@ connection_dirserv_add_servers_to_outbuf(dir_connection_t *conn)
body = signed_descriptor_get_body(sd); body = signed_descriptor_get_body(sd);
if (conn->zlib_state) { if (conn->zlib_state) {
int last = ! smartlist_len(conn->fingerprint_stack); int last = ! smartlist_len(conn->fingerprint_stack);
connection_write_to_buf_zlib( connection_write_to_buf_zlib(conn, body,
conn, conn->zlib_state, sd->signed_descriptor_len, last);
body, sd->signed_descriptor_len,
last);
if (last) { if (last) {
tor_zlib_free(conn->zlib_state); tor_zlib_free(conn->zlib_state);
conn->zlib_state = NULL; conn->zlib_state = NULL;
@ -1905,7 +1903,7 @@ connection_dirserv_add_dir_bytes_to_outbuf(dir_connection_t *conn)
bytes = remaining; bytes = remaining;
if (conn->zlib_state) { 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, conn->cached_dir->dir_z + conn->cached_dir_offset,
bytes, bytes == remaining); bytes, bytes == remaining);
} else { } else {

View File

@ -1836,7 +1836,6 @@ void _connection_controller_force_write(control_connection_t *conn);
void connection_write_to_buf(const char *string, size_t len, void connection_write_to_buf(const char *string, size_t len,
connection_t *conn); connection_t *conn);
void connection_write_to_buf_zlib(dir_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, const char *data, size_t data_len,
int done); int done);