proxygen
folly::HandshakeTimeoutCallback Class Reference

#include <AsyncSSLSocketTest.h>

Inheritance diagram for folly::HandshakeTimeoutCallback:
folly::SSLServerAcceptCallbackBase folly::AsyncServerSocket::AcceptCallback

Public Member Functions

 HandshakeTimeoutCallback (HandshakeCallback *hcb)
 
void connAccepted (const std::shared_ptr< folly::AsyncSSLSocket > &s) noexceptoverride
 
- Public Member Functions inherited from folly::SSLServerAcceptCallbackBase
 SSLServerAcceptCallbackBase (HandshakeCallback *hcb)
 
 ~SSLServerAcceptCallbackBase () override
 
void acceptError (const std::exception &ex) noexceptoverride
 
void connectionAccepted (int fd, const SocketAddress &) noexceptoverride
 
void detach ()
 
- Public Member Functions inherited from folly::AsyncServerSocket::AcceptCallback
virtual ~AcceptCallback ()=default
 
virtual void acceptStarted () noexcept
 
virtual void acceptStopped () noexcept
 

Additional Inherited Members

- Public Attributes inherited from folly::SSLServerAcceptCallbackBase
StateEnum state
 
HandshakeCallbackhcb_
 
std::shared_ptr< SSLContextctx_
 
std::shared_ptr< AsyncSSLSocketsocket_
 
EventBasebase_
 

Detailed Description

Definition at line 667 of file AsyncSSLSocketTest.h.

Constructor & Destructor Documentation

folly::HandshakeTimeoutCallback::HandshakeTimeoutCallback ( HandshakeCallback hcb)
inlineexplicit

Definition at line 669 of file AsyncSSLSocketTest.h.

SSLServerAcceptCallbackBase(HandshakeCallback *hcb)
Definition: TestSSLServer.h:51

Member Function Documentation

void folly::HandshakeTimeoutCallback::connAccepted ( const std::shared_ptr< folly::AsyncSSLSocket > &  s)
inlineoverridevirtualnoexcept

Implements folly::SSLServerAcceptCallbackBase.

Definition at line 672 of file AsyncSSLSocketTest.h.

References EXPECT_EQ, folly::AsyncSocket::getEventBase(), s, folly::AsyncSSLSocket::STATE_ACCEPTING, folly::STATE_SUCCEEDED, folly::AsyncSSLSocket::STATE_UNINIT, and folly::TimeoutManager::tryRunAfterDelay().

673  {
674  std::cerr << "HandshakeErrorCallback::connAccepted" << std::endl;
675 
676  auto sock = std::static_pointer_cast<AsyncSSLSocket>(s);
677 
678  hcb_->setSocket(sock);
679  sock->getEventBase()->tryRunAfterDelay(
680  [=] {
681  std::cerr << "Delayed SSL accept, client will have close by now"
682  << std::endl;
683  // SSL accept will fail
684  EXPECT_EQ(sock->getSSLState(), AsyncSSLSocket::STATE_UNINIT);
685  hcb_->socket_->sslAccept(hcb_);
686  // This registers for an event
687  EXPECT_EQ(sock->getSSLState(), AsyncSSLSocket::STATE_ACCEPTING);
688 
690  },
691  100);
692  }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
void setSocket(const std::shared_ptr< AsyncSSLSocket > &socket)
std::shared_ptr< AsyncSSLSocket > socket_
static set< string > s
state
Definition: http_parser.c:272

The documentation for this class was generated from the following file: