diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-08-26 15:33:19 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2010-09-27 14:22:11 -0400 |
commit | 0c9b64d449a725dc2f9f043d174b581e3a5d9cb2 (patch) | |
tree | 19ecfaf74f334c5881e476d5b92ade3b82970d55 /src/or/connection.c | |
parent | 9796b9bfa6a757780d6185547e4baf739c53cdac (diff) | |
download | tor-0c9b64d449a725dc2f9f043d174b581e3a5d9cb2.tar tor-0c9b64d449a725dc2f9f043d174b581e3a5d9cb2.tar.gz |
Get zlib compression working with bufferevents.
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index e688f4c8b..b5496d72d 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -3088,11 +3088,19 @@ _connection_write_to_buf_impl(const char *string, size_t len, return; IF_HAS_BUFFEREVENT(conn, { - if (bufferevent_write(conn->bufev, string, len)<0) { - /* XXXX mark for close? */ - log_warn(LD_NET, "bufferevent_write failed! That shouldn't happen."); - } - return; + if (zlib) { + int done = zlib < 0; + r = write_to_evbuffer_zlib(bufferevent_get_output(conn->bufev), + TO_DIR_CONN(conn)->zlib_state, + string, len, done); + } else { + r = bufferevent_write(conn->bufev, string, len); + } + if (r < 0) { + /* XXXX mark for close? */ + log_warn(LD_NET, "bufferevent_write failed! That shouldn't happen."); + } + return; }); old_datalen = buf_datalen(conn->outbuf); |