Allow underlying transport to be accessible from AsyncTransportWrapper
authorSubodh Iyengar <subodh@fb.com>
Wed, 4 Nov 2015 01:19:40 +0000 (17:19 -0800)
committerfacebook-github-bot-9 <folly-bot@fb.com>
Wed, 4 Nov 2015 02:20:26 +0000 (18:20 -0800)
Summary: Allow underlying transport to be accessible from AsyncTransportWrapper.
There are some code paths where we need access to the real transport from
the AsyncTransportWrapper. This allows us to retrieve the underlying transport
and have clients like HTTPSession use it.

Reviewed By: afrind

Differential Revision: D2609200

fb-gh-sync-id: 2b317d1825a005bb64468f83c64bc3f1c9bdfe2c

folly/io/async/AsyncTransport.h

index ee8e8ea646e5d8d5fda2f97ebefb007e517dfcf1..26cafbff99d1d7b13e352e302a0cdf4aba89ff8f 100644 (file)
@@ -525,6 +525,14 @@ class AsyncTransportWrapper : virtual public AsyncTransport,
   virtual void writeChain(WriteCallback* callback,
                           std::unique_ptr<IOBuf>&& buf,
                           WriteFlags flags = WriteFlags::NONE) override = 0;
   virtual void writeChain(WriteCallback* callback,
                           std::unique_ptr<IOBuf>&& buf,
                           WriteFlags flags = WriteFlags::NONE) override = 0;
+  /**
+   * The transport wrapper may wrap another transport. This returns the
+   * transport that is wrapped. It returns nullptr if there is no wrapped
+   * transport.
+   */
+  virtual AsyncTransportWrapper* getWrappedTransport() {
+    return nullptr;
+  }
 };
 
 } // folly
 };
 
 } // folly