proxygen
wangle::ClientBootstrap< Pipeline >::ConnectCallback Class Reference
Inheritance diagram for wangle::ClientBootstrap< Pipeline >::ConnectCallback:
folly::AsyncSocket::ConnectCallback

Public Member Functions

 ConnectCallback (folly::Promise< Pipeline * > promise, ClientBootstrap *bootstrap, std::shared_ptr< folly::AsyncSocket > socket, SSLSessionEstablishedCallbackUniquePtr sslSessionEstablishedCallback)
 
void connectSuccess () noexceptoverride
 
void connectErr (const folly::AsyncSocketException &ex) noexceptoverride
 
- Public Member Functions inherited from folly::AsyncSocket::ConnectCallback
virtual ~ConnectCallback ()=default
 

Private Attributes

folly::Promise< Pipeline * > promise_
 
ClientBootstrapbootstrap_
 
std::shared_ptr< folly::AsyncSocketsocket_
 
folly::DestructorCheck::Safety safety_
 
SSLSessionEstablishedCallbackUniquePtr sslSessionEstablishedCallback_
 

Detailed Description

template<typename Pipeline>
class wangle::ClientBootstrap< Pipeline >::ConnectCallback

Definition at line 37 of file ClientBootstrap.h.

Constructor & Destructor Documentation

template<typename Pipeline>
wangle::ClientBootstrap< Pipeline >::ConnectCallback::ConnectCallback ( folly::Promise< Pipeline * >  promise,
ClientBootstrap bootstrap,
std::shared_ptr< folly::AsyncSocket socket,
SSLSessionEstablishedCallbackUniquePtr  sslSessionEstablishedCallback 
)
inline

Definition at line 39 of file ClientBootstrap.h.

Referenced by wangle::ClientBootstrap< DefaultPipeline >::connect().

44  : promise_(std::move(promise)),
45  bootstrap_(bootstrap),
46  socket_(socket),
47  safety_(*bootstrap),
SSLSessionEstablishedCallbackUniquePtr sslSessionEstablishedCallback_
BaseClientBootstrap * sslSessionEstablishedCallback(SSLSessionEstablishedCallbackUniquePtr sslSessionEstablishedCallback)
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::shared_ptr< folly::AsyncSocket > socket_
NetworkSocket socket(int af, int type, int protocol)
Definition: NetOps.cpp:412
folly::Promise< Pipeline * > promise_
folly::DestructorCheck::Safety safety_

Member Function Documentation

template<typename Pipeline>
void wangle::ClientBootstrap< Pipeline >::ConnectCallback::connectErr ( const folly::AsyncSocketException ex)
inlineoverridevirtualnoexcept

connectErr() will be invoked if the connection attempt fails.

Parameters
exAn exception describing the error that occurred.

Implements folly::AsyncSocket::ConnectCallback.

Definition at line 71 of file ClientBootstrap.h.

References wangle::ClientBootstrap< Pipeline >::ConnectCallback::promise_.

71  {
72  promise_.setException(
73  folly::make_exception_wrapper<folly::AsyncSocketException>(ex));
74  delete this;
75  }
folly::Promise< Pipeline * > promise_
template<typename Pipeline>
void wangle::ClientBootstrap< Pipeline >::ConnectCallback::connectSuccess ( )
inlineoverridevirtualnoexcept

connectSuccess() will be invoked when the connection has been successfully established.

Implements folly::AsyncSocket::ConnectCallback.

Definition at line 51 of file ClientBootstrap.h.

References wangle::ClientBootstrap< Pipeline >::ConnectCallback::bootstrap_, folly::DestructorCheck::Safety::destroyed(), wangle::BaseClientBootstrap< P >::getPipeline(), folly::AsyncSSLSocket::getSSLSession(), folly::AsyncSSLSocket::getSSLSessionReused(), wangle::BaseClientBootstrap< P >::makePipeline(), folly::gen::move, wangle::ClientBootstrap< Pipeline >::ConnectCallback::promise_, wangle::ClientBootstrap< Pipeline >::ConnectCallback::safety_, wangle::ClientBootstrap< Pipeline >::ConnectCallback::socket_, wangle::ClientBootstrap< Pipeline >::ConnectCallback::sslSessionEstablishedCallback_, and wangle::Pipeline< R, W >::transportActive().

51  {
52  if (!safety_.destroyed()) {
53 
55  AsyncSSLSocket* sslSocket =
56  dynamic_cast<AsyncSSLSocket*>(socket_.get());
57  if (sslSocket && !sslSocket->getSSLSessionReused()) {
58  sslSessionEstablishedCallback_->onEstablished(
59  sslSocket->getSSLSession());
60  }
61  }
63  if (bootstrap_->getPipeline()) {
65  }
66  promise_.setValue(bootstrap_->getPipeline());
67  }
68  delete this;
69  }
SSLSessionEstablishedCallbackUniquePtr sslSessionEstablishedCallback_
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::enable_if<!std::is_same< T, folly::Unit >::value >::type transportActive()
Definition: Pipeline-inl.h:205
std::shared_ptr< folly::AsyncSocket > socket_
virtual bool getSSLSessionReused() const
folly::Promise< Pipeline * > promise_
SSL_SESSION * getSSLSession()
virtual void makePipeline(std::shared_ptr< folly::AsyncTransportWrapper > socket)
folly::DestructorCheck::Safety safety_

Member Data Documentation

template<typename Pipeline>
ClientBootstrap* wangle::ClientBootstrap< Pipeline >::ConnectCallback::bootstrap_
private
template<typename Pipeline>
folly::DestructorCheck::Safety wangle::ClientBootstrap< Pipeline >::ConnectCallback::safety_
private
template<typename Pipeline>
std::shared_ptr<folly::AsyncSocket> wangle::ClientBootstrap< Pipeline >::ConnectCallback::socket_
private
template<typename Pipeline>
SSLSessionEstablishedCallbackUniquePtr wangle::ClientBootstrap< Pipeline >::ConnectCallback::sslSessionEstablishedCallback_
private

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