From bf29c7e0c2f84196519cec735c811a8c0016df85 Mon Sep 17 00:00:00 2001 From: Mingtao Yang Date: Thu, 17 Aug 2017 13:54:11 -0700 Subject: [PATCH] Add getSSLContext() to AsyncSSLSocket Reviewed By: knekritz Differential Revision: D5632201 fbshipit-source-id: 5db380379ab6cb608922c77dd716bfc4410b2cd8 --- folly/io/async/AsyncSSLSocket.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/folly/io/async/AsyncSSLSocket.h b/folly/io/async/AsyncSSLSocket.h index 84551d77..874fb9dd 100644 --- a/folly/io/async/AsyncSSLSocket.h +++ b/folly/io/async/AsyncSSLSocket.h @@ -557,6 +557,18 @@ class AsyncSSLSocket : public virtual AsyncSocket { void detachSSLContext(); #endif + /** + * Returns the original folly::SSLContext associated with this socket. + * + * Suitable for use in AsyncSSLSocket constructor to construct a new + * AsyncSSLSocket using an existing socket's context. + * + * switchServerSSLContext() does not affect this return value. + */ + const std::shared_ptr& getSSLContext() const { + return ctx_; + } + #if FOLLY_OPENSSL_HAS_SNI /** * Switch the SSLContext to continue the SSL handshake. -- 2.34.1