You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jk...@apache.org on 2018/09/16 10:51:47 UTC
[thrift] 01/02: THRIFT-4620: Ensure enough space for for zlib flush
marker Client: lib/cpp
This is an automated email from the ASF dual-hosted git repository.
jking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git
commit 27705f487d897935b2735e5b50278a5503912616
Author: Dominic Coyne <do...@jhc.financial>
AuthorDate: Tue Sep 11 13:03:17 2018 +0100
THRIFT-4620: Ensure enough space for for zlib flush marker
Client: lib/cpp
---
lib/cpp/src/thrift/transport/TZlibTransport.cpp | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lib/cpp/src/thrift/transport/TZlibTransport.cpp b/lib/cpp/src/thrift/transport/TZlibTransport.cpp
index fb5cc5d..e426dc3 100644
--- a/lib/cpp/src/thrift/transport/TZlibTransport.cpp
+++ b/lib/cpp/src/thrift/transport/TZlibTransport.cpp
@@ -255,6 +255,15 @@ void TZlibTransport::flush() {
throw TTransportException(TTransportException::BAD_ARGS, "flush() called after finish()");
}
+ flushToZlib(uwbuf_, uwpos_, Z_BLOCK);
+ uwpos_ = 0;
+
+ if(wstream_->avail_out < 6){
+ transport_->write(cwbuf_, cwbuf_size_ - wstream_->avail_out);
+ wstream_->next_out = cwbuf_;
+ wstream_->avail_out = cwbuf_size_;
+ }
+
flushToTransport(Z_FULL_FLUSH);
}
@@ -285,7 +294,7 @@ void TZlibTransport::flushToZlib(const uint8_t* buf, int len, int flush) {
wstream_->avail_in = len;
while (true) {
- if (flush == Z_NO_FLUSH && wstream_->avail_in == 0) {
+ if ((flush == Z_NO_FLUSH || flush == Z_BLOCK) && wstream_->avail_in == 0) {
break;
}