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 2017/09/22 22:16:22 UTC

thrift git commit: THRIFT-3766: add zlib getUnderlyingTransport method Client: C++

Repository: thrift
Updated Branches:
  refs/heads/master 4a6bff1c5 -> d3013f3fb


THRIFT-3766: add zlib getUnderlyingTransport method
Client: C++

This closes #1370


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/d3013f3f
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/d3013f3f
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/d3013f3f

Branch: refs/heads/master
Commit: d3013f3fb5d83e201723cd97cab49d8203037c0d
Parents: 4a6bff1
Author: James E. King, III <jk...@apache.org>
Authored: Fri Sep 22 11:41:10 2017 -0700
Committer: James E. King, III <jk...@apache.org>
Committed: Fri Sep 22 15:15:30 2017 -0700

----------------------------------------------------------------------
 lib/cpp/src/thrift/transport/TZlibTransport.h | 2 ++
 lib/cpp/test/ZlibTest.cpp                     | 7 +++++++
 2 files changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/d3013f3f/lib/cpp/src/thrift/transport/TZlibTransport.h
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/transport/TZlibTransport.h b/lib/cpp/src/thrift/transport/TZlibTransport.h
index 4803c61..a0fb464 100644
--- a/lib/cpp/src/thrift/transport/TZlibTransport.h
+++ b/lib/cpp/src/thrift/transport/TZlibTransport.h
@@ -180,6 +180,8 @@ public:
   static const int DEFAULT_UWBUF_SIZE = 128;
   static const int DEFAULT_CWBUF_SIZE = 1024;
 
+  stdcxx::shared_ptr<TTransport> getUnderlyingTransport() const { return transport_; }
+
 protected:
   inline void checkZlibRv(int status, const char* msg);
   inline void checkZlibRvNothrow(int status, const char* msg);

http://git-wip-us.apache.org/repos/asf/thrift/blob/d3013f3f/lib/cpp/test/ZlibTest.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/test/ZlibTest.cpp b/lib/cpp/test/ZlibTest.cpp
index a4479eb..ea54487 100644
--- a/lib/cpp/test/ZlibTest.cpp
+++ b/lib/cpp/test/ZlibTest.cpp
@@ -332,6 +332,12 @@ void test_no_write() {
   BOOST_CHECK_EQUAL(membuf->available_read(), (uint32_t)0);
 }
 
+void test_get_underlying_transport() {
+  shared_ptr<TMemoryBuffer> membuf(new TMemoryBuffer());
+  shared_ptr<TZlibTransport> zlib_trans(new TZlibTransport(membuf));
+  BOOST_CHECK_EQUAL(membuf.get(), zlib_trans->getUnderlyingTransport().get());
+}
+
 /*
  * Initialization
  */
@@ -436,6 +442,7 @@ bool init_unit_test_suite() {
   add_tests(suite, gen_random_buffer(buf_len), buf_len, "random");
 
   suite->add(BOOST_TEST_CASE(test_no_write));
+  suite->add(BOOST_TEST_CASE(test_get_underlying_transport));
 
   return true;
 }