aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@torproject.org>2017-04-18 01:10:25 +0200
committerAlexander Færøy <ahf@torproject.org>2017-04-18 01:10:25 +0200
commit4b9349192d4bd2e9c598b13d74bc826c8f16d40e (patch)
tree4f95f1bf1d0c4de60e72ccc4fc0946c93c1fdd38
parent3c4459bcbf1d3a9da4a8b3a8bfed10d2e045af74 (diff)
downloadtor-4b9349192d4bd2e9c598b13d74bc826c8f16d40e.tar.gz
tor-4b9349192d4bd2e9c598b13d74bc826c8f16d40e.zip
Rename `zlib_state` to `compress_state` in `dir_connection_t`.
This patch renames the `zlib_state` field in `dir_connection_t` to `compress_state`. See https://bugs.torproject.org/21663
-rw-r--r--src/or/circuitlist.c8
-rw-r--r--src/or/connection.c4
-rw-r--r--src/or/directory.c13
-rw-r--r--src/or/dirserv.c10
-rw-r--r--src/or/or.h2
5 files changed, 19 insertions, 18 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 4f11586373..365e5b2f89 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -1990,10 +1990,10 @@ single_conn_free_bytes(connection_t *conn)
}
if (conn->type == CONN_TYPE_DIR) {
dir_connection_t *dir_conn = TO_DIR_CONN(conn);
- if (dir_conn->zlib_state) {
- result += tor_compress_state_size(dir_conn->zlib_state);
- tor_compress_free(dir_conn->zlib_state);
- dir_conn->zlib_state = NULL;
+ if (dir_conn->compress_state) {
+ result += tor_compress_state_size(dir_conn->compress_state);
+ tor_compress_free(dir_conn->compress_state);
+ dir_conn->compress_state = NULL;
}
}
return result;
diff --git a/src/or/connection.c b/src/or/connection.c
index ad97c3bc2a..70b08e2deb 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -628,7 +628,7 @@ connection_free_(connection_t *conn)
dir_connection_t *dir_conn = TO_DIR_CONN(conn);
tor_free(dir_conn->requested_resource);
- tor_compress_free(dir_conn->zlib_state);
+ tor_compress_free(dir_conn->compress_state);
if (dir_conn->spool) {
SMARTLIST_FOREACH(dir_conn->spool, spooled_resource_t *, spooled,
spooled_resource_free(spooled));
@@ -4061,7 +4061,7 @@ connection_write_to_buf_impl_,(const char *string, size_t len,
dir_connection_t *dir_conn = TO_DIR_CONN(conn);
int done = zlib < 0;
CONN_LOG_PROTECT(conn, r = write_to_buf_zlib(conn->outbuf,
- dir_conn->zlib_state,
+ dir_conn->compress_state,
string, len, done));
} else {
CONN_LOG_PROTECT(conn, r = write_to_buf(string, len, conn->outbuf));
diff --git a/src/or/directory.c b/src/or/directory.c
index 5ae61e470f..098683e919 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -3178,7 +3178,8 @@ handle_get_current_consensus(dir_connection_t *conn,
write_http_response_header(conn, -1, compressed,
smartlist_len(conn->spool) == 1 ? lifetime : 0);
if (! compressed)
- conn->zlib_state = tor_compress_new(0, ZLIB_METHOD, HIGH_COMPRESSION);
+ conn->compress_state = tor_compress_new(0, ZLIB_METHOD,
+ HIGH_COMPRESSION);
/* Prime the connection with some data. */
const int initial_flush_result = connection_dirserv_flushed_some(conn);
@@ -3276,7 +3277,7 @@ handle_get_status_vote(dir_connection_t *conn, const get_handler_args_t *args)
if (smartlist_len(items)) {
if (compressed) {
- conn->zlib_state = tor_compress_new(1, ZLIB_METHOD,
+ conn->compress_state = tor_compress_new(1, ZLIB_METHOD,
choose_compression_level(estimated_len));
SMARTLIST_FOREACH(items, const char *, c,
connection_write_to_buf_zlib(c, strlen(c), conn, 0));
@@ -3335,7 +3336,7 @@ handle_get_microdesc(dir_connection_t *conn, const get_handler_args_t *args)
write_http_response_header(conn, -1, compressed, MICRODESC_CACHE_LIFETIME);
if (compressed)
- conn->zlib_state = tor_compress_new(1, ZLIB_METHOD,
+ conn->compress_state = tor_compress_new(1, ZLIB_METHOD,
choose_compression_level(size_guess));
const int initial_flush_result = connection_dirserv_flushed_some(conn);
@@ -3428,7 +3429,7 @@ handle_get_descriptor(dir_connection_t *conn, const get_handler_args_t *args)
}
write_http_response_header(conn, -1, compressed, cache_lifetime);
if (compressed)
- conn->zlib_state = tor_compress_new(1, ZLIB_METHOD,
+ conn->compress_state = tor_compress_new(1, ZLIB_METHOD,
choose_compression_level(size_guess));
clear_spool = 0;
/* Prime the connection with some data. */
@@ -3519,8 +3520,8 @@ handle_get_keys(dir_connection_t *conn, const get_handler_args_t *args)
write_http_response_header(conn, compressed?-1:len, compressed, 60*60);
if (compressed) {
- conn->zlib_state = tor_compress_new(1, ZLIB_METHOD,
- choose_compression_level(len));
+ conn->compress_state = tor_compress_new(1, ZLIB_METHOD,
+ choose_compression_level(len));
SMARTLIST_FOREACH(certs, authority_cert_t *, c,
connection_write_to_buf_zlib(c->cache_info.signed_descriptor_body,
c->cache_info.signed_descriptor_len,
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 186478c1c7..2746d09543 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -3497,7 +3497,7 @@ spooled_resource_flush_some(spooled_resource_t *spooled,
/* Absent objects count as "done". */
return SRFS_DONE;
}
- if (conn->zlib_state) {
+ if (conn->compress_state) {
connection_write_to_buf_zlib((const char*)body, bodylen, conn, 0);
} else {
connection_write_to_buf((const char*)body, bodylen, TO_CONN(conn));
@@ -3523,7 +3523,7 @@ spooled_resource_flush_some(spooled_resource_t *spooled,
if (BUG(remaining < 0))
return SRFS_ERR;
ssize_t bytes = (ssize_t) MIN(DIRSERV_CACHED_DIR_CHUNK_SIZE, remaining);
- if (conn->zlib_state) {
+ if (conn->compress_state) {
connection_write_to_buf_zlib(cached->dir_z + spooled->cached_dir_offset,
bytes, conn, 0);
} else {
@@ -3788,12 +3788,12 @@ connection_dirserv_flushed_some(dir_connection_t *conn)
/* If we get here, we're done. */
smartlist_free(conn->spool);
conn->spool = NULL;
- if (conn->zlib_state) {
+ if (conn->compress_state) {
/* Flush the zlib state: there could be more bytes pending in there, and
* we don't want to omit bytes. */
connection_write_to_buf_zlib("", 0, conn, 1);
- tor_compress_free(conn->zlib_state);
- conn->zlib_state = NULL;
+ tor_compress_free(conn->compress_state);
+ conn->compress_state = NULL;
}
return 0;
}
diff --git a/src/or/or.h b/src/or/or.h
index 6aec5882b0..20c4ebccd0 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1774,7 +1774,7 @@ typedef struct dir_connection_t {
* it from back to front. */
smartlist_t *spool;
/** The compression object doing on-the-fly compression for spooled data. */
- tor_compress_state_t *zlib_state;
+ tor_compress_state_t *compress_state;
/** What rendezvous service are we querying for? */
rend_data_t *rend_data;