25 if (!transition.first) {
26 VLOG(5) <<
"Ignoring call to start(), since state is currently " 27 <<
static_cast<unsigned>(transition.second);
31 originalEvb_ = sock->getEventBase();
34 sock->detachEventBase();
35 handshakeEvb_->runInEventBaseThread(
36 [
this, sock =
std::move(sock) ]()
mutable {
37 sock->attachEventBase(handshakeEvb_);
56 folly::make_exception_wrapper<std::runtime_error>(
"connection dropped"),
59 if (transition.first) {
65 VLOG(5) <<
"callback has not been received. dropConnection " 66 <<
"calling underlying helper";
68 helper_->dropConnection(reason);
90 if (!transition.first) {
91 VLOG(5) <<
"Ignoring call to connectionReady(), expected state to be " 93 <<
" but actual state was " 94 << static_cast<unsigned>(transition.second);
98 transport->detachEventBase();
108 VLOG(5) <<
"calling underlying callback connectionReady";
134 if (!transition.first) {
135 VLOG(5) <<
"Ignoring call to connectionError(), expected state to be " 137 <<
" but actual state was " 138 << static_cast<unsigned>(transition.second);
144 [
this, sslErr, ex =
std::move(ex)]()
mutable {
146 VLOG(5) <<
"calling underlying callback connectionError";
158 std::pair<bool, EvbHandshakeHelper::HandshakeState>
162 bool res =
state_.compare_exchange_strong(expected, next);
163 return std::make_pair(res, expected);
167 VLOG(5) <<
"evbhandshakehelper is destroyed";
virtual void connectionError(folly::AsyncTransportWrapper *transport, folly::exception_wrapper ex, folly::Optional< SSLErrorEnum > sslErr) noexceptoverride
constexpr detail::Map< Move > move
void start(folly::AsyncSSLSocket::UniquePtr sock, AcceptorHandshakeHelper::Callback *callback) noexceptoverride
requires E e noexcept(noexcept(s.error(std::move(e))))
AcceptorHandshakeHelper::Callback * callback_
folly::EventBase * originalEvb_
std::unique_ptr< AsyncSSLSocket, Destructor > UniquePtr
std::unique_ptr< AsyncTransportWrapper, Destructor > UniquePtr
virtual void connectionReady(folly::AsyncTransportWrapper::UniquePtr transport, std::string nextProtocol, SecureTransportType secureTransportType, folly::Optional< SSLErrorEnum > sslErr) noexcept=0
void dropConnection(SSLErrorEnum reason=SSLErrorEnum::NO_ERROR) override
FOLLY_CPP14_CONSTEXPR bool hasValue() const noexcept
bool runInEventBaseThread(void(*fn)(T *), T *arg)
std::pair< bool, HandshakeState > tryTransition(HandshakeState expected, HandshakeState next)
folly::EventBase * handshakeEvb_
virtual void connectionError(folly::AsyncTransportWrapper *transport, folly::exception_wrapper ex, folly::Optional< SSLErrorEnum > sslErr) noexcept=0
Value & emplace(Args &&...args)
void dcheckIsInEventBaseThread() const
AcceptorHandshakeHelper::UniquePtr helper_
virtual void connectionReady(folly::AsyncTransportWrapper::UniquePtr transport, std::string nextProtocol, SecureTransportType secureTransportType, folly::Optional< SSLErrorEnum > sslErr) noexceptoverride
folly::Function< void()> callback_
std::atomic< HandshakeState > state_
folly::Optional< folly::DelayedDestruction::DestructorGuard > dropConnectionGuard_