THRIFT-1564 Minor fixes to TZlibTransport

Patch: Dave Watson

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1325712 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Roger Meier 2012-04-13 10:30:11 +00:00
parent 33eaa0f100
commit a3410db0c8
2 changed files with 9 additions and 2 deletions

View File

@ -110,9 +110,15 @@ TZlibTransport::~TZlibTransport() {
}
bool TZlibTransport::isOpen() {
return (readAvail() > 0) || transport_->isOpen();
return (readAvail() > 0) || (rstream_->avail_in > 0) || transport_->isOpen();
}
bool TZlibTransport::peek() {
return (readAvail() > 0) || (rstream_->avail_in > 0) || transport_->peek();
}
// READING STRATEGY
//
// We have two buffers for reading: one containing the compressed data (crbuf_)
@ -253,7 +259,7 @@ void TZlibTransport::flush() {
"flush() called after finish()");
}
flushToTransport(Z_SYNC_FLUSH);
flushToTransport(Z_FULL_FLUSH);
}
void TZlibTransport::finish() {

View File

@ -144,6 +144,7 @@ class TZlibTransport : public TVirtualTransport<TZlibTransport> {
~TZlibTransport();
bool isOpen();
bool peek();
void open() {
transport_->open();