Check if handshake timeout is set in AsyncSSLSocket::isDetachable().
authorKyle Nekritz <knekritz@fb.com>
Mon, 5 Oct 2015 20:28:42 +0000 (13:28 -0700)
committerfacebook-github-bot-9 <folly-bot@fb.com>
Mon, 5 Oct 2015 21:20:16 +0000 (14:20 -0700)
Summary: If it is, return false.

Reviewed By: @siyengar

Differential Revision: D2503765

fb-gh-sync-id: 36b5e2e8cabc2a5157735637be6ca3414005da81

folly/io/async/AsyncSSLSocket.h

index 6fead8468d60fb1b97dfb2f88bc392f4a54bbde9..dd328703297ec4eb73330fd91808c205ee9afefa 100644 (file)
@@ -323,10 +323,10 @@ class AsyncSSLSocket : public virtual AsyncSocket {
 
   /**
    * Initiate an SSL connection on the socket
-   * THe callback will be invoked and uninstalled when an SSL connection
+   * The callback will be invoked and uninstalled when an SSL connection
    * has been establshed on the underlying socket.
-   * The verification option verifyPeer is applied if its passed explicitly.
-   * If its not, the options in SSLContext set on the underying SSLContext
+   * The verification option verifyPeer is applied if it's passed explicitly.
+   * If it's not, the options in SSLContext set on the underlying SSLContext
    * are applied.
    *
    * @param callback callback object to invoke on success/failure
@@ -488,6 +488,10 @@ class AsyncSSLSocket : public virtual AsyncSocket {
     handshakeTimeout_.detachEventBase();
   }
 
+  virtual bool isDetachable() const override {
+    return AsyncSocket::isDetachable() && !handshakeTimeout_.isScheduled();
+  }
+
   virtual void attachTimeoutManager(TimeoutManager* manager) {
     handshakeTimeout_.attachTimeoutManager(manager);
   }