Explicitly initialize AsyncSocket in MockAsyncSSLSocket
authorMingtao Yang <mingtao@fb.com>
Tue, 22 Aug 2017 17:36:32 +0000 (10:36 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 22 Aug 2017 17:57:06 +0000 (10:57 -0700)
Summary:
Even though MockAsyncSSLSocket's initializes AsyncSSLSocket, which should
initialize AsyncSocket, this does not actually happen because AsyncSSLSocket
virtually inherits from AsyncSocket.

Because of this, prior to this diff, the MockAsyncSSLSocket was not properly
setting its EventBase.

Reviewed By: knekritz

Differential Revision: D5676596

fbshipit-source-id: 5f3c0e848179cb5eb4d2dc4921a11e7c04d7c0e0

folly/io/async/test/MockAsyncSSLSocket.h

index a627ba4645788181b22e0579090da37c18206393..cff750f8ccb3d12583182be2533b04f56efae62d 100644 (file)
@@ -23,11 +23,11 @@ namespace folly { namespace test {
 class MockAsyncSSLSocket : public AsyncSSLSocket {
  public:
   MockAsyncSSLSocket(
-   const std::shared_ptr<SSLContext>& ctx,
-   EventBase* base,
-   bool deferSecurityNegotiation = false) :
-    AsyncSSLSocket(ctx, base, deferSecurityNegotiation) {
-  }
+      const std::shared_ptr<SSLContext>& ctx,
+      EventBase* base,
+      bool deferSecurityNegotiation = false)
+      : AsyncSocket(base),
+        AsyncSSLSocket(ctx, base, deferSecurityNegotiation) {}
 
   GMOCK_METHOD5_(, noexcept, ,
    connect,