diff options
author | teor <teor2345@gmail.com> | 2017-06-16 09:48:18 +1000 |
---|---|---|
committer | teor <teor2345@gmail.com> | 2017-06-16 09:48:18 +1000 |
commit | 7d535ea9d3a0b2706392425c13feac760dfccdee (patch) | |
tree | 2df61d0c97acaeab396dec88ebb7920742e1616a /src/common/compress.c | |
parent | cbaf0c049c8a73a7bbd2e8bf574589f84f99ccd8 (diff) | |
download | tor-7d535ea9d3a0b2706392425c13feac760dfccdee.tar.gz tor-7d535ea9d3a0b2706392425c13feac760dfccdee.zip |
Add extra logging during compression and decompression
This helps diagnose failures.
Part of #22502.
Diffstat (limited to 'src/common/compress.c')
-rw-r--r-- | src/common/compress.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/common/compress.c b/src/common/compress.c index ee9de6a768..e65894d9d2 100644 --- a/src/common/compress.c +++ b/src/common/compress.c @@ -102,8 +102,13 @@ tor_compress_impl(int compress, stream = tor_compress_new(compress, method, compression_level); - if (stream == NULL) + if (stream == NULL) { + log_warn(LD_GENERAL, "NULL stream while %scompressing", + compress?"":"de"); + log_debug(LD_GENERAL, "method: %d level: %d at len: %zd", + method, compression_level, in_len); return -1; + } size_t in_len_orig = in_len; size_t out_remaining, out_alloc; @@ -137,6 +142,12 @@ tor_compress_impl(int compress, break; case TOR_COMPRESS_OK: if (compress || complete_only) { + log_fn(protocol_warn_level, LD_PROTOCOL, + "Unexpected %s while %scompressing", + complete_only?"end of input":"result", + compress?"":"de"); + log_debug(LD_GENERAL, "method: %d level: %d at len: %zd", + method, compression_level, in_len); goto err; } else { if (in_len != 0) { |