proxygen
fizz::server::AsyncFizzServerT< SM > Class Template Reference

#include <AsyncFizzServer.h>

Inheritance diagram for fizz::server::AsyncFizzServerT< SM >:
fizz::AsyncFizzBase folly::WriteChainAsyncTransportWrapper< folly::AsyncTransportWrapper > folly::AsyncWriter::WriteCallback folly::AsyncReader::ReadCallback folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper > folly::AsyncTransportWrapper folly::AsyncTransport folly::AsyncReader folly::AsyncWriter folly::DelayedDestruction folly::AsyncSocketBase folly::DelayedDestructionBase fizz::server::test::MockAsyncFizzServerT< SM >

Classes

class  ActionMoveVisitor
 
class  HandshakeCallback
 

Public Types

using UniquePtr = std::unique_ptr< AsyncFizzServerT, folly::DelayedDestruction::Destructor >
 
- Public Types inherited from fizz::AsyncFizzBase
using UniquePtr = std::unique_ptr< AsyncFizzBase, folly::DelayedDestruction::Destructor >
 
using ReadCallback = folly::AsyncTransportWrapper::ReadCallback
 
- Public Types inherited from folly::AsyncTransportWrapper
using UniquePtr = std::unique_ptr< AsyncTransportWrapper, Destructor >
 
using ReadCallback = AsyncReader::ReadCallback
 
using WriteCallback = AsyncWriter::WriteCallback
 
- Public Types inherited from folly::AsyncTransport
typedef std::unique_ptr< AsyncTransport, DestructorUniquePtr
 

Public Member Functions

 AsyncFizzServerT (folly::AsyncTransportWrapper::UniquePtr socket, const std::shared_ptr< FizzServerContext > &fizzContext, const std::shared_ptr< ServerExtensions > &extensions=nullptr)
 
virtual void accept (HandshakeCallback *callback)
 
bool good () const override
 
bool readable () const override
 
bool connecting () const override
 
bool error () const override
 
bool isDetachable () const override
 
void attachEventBase (folly::EventBase *evb) override
 
folly::ssl::X509UniquePtr getPeerCert () const override
 
const X509getSelfCert () const override
 
bool isReplaySafe () const override
 
void setReplaySafetyCallback (folly::AsyncTransport::ReplaySafetyCallback *callback) override
 
std::string getApplicationProtocol () const noexceptoverride
 
void close () override
 
void closeWithReset () override
 
void closeNow () override
 
const StategetState () const
 
folly::Optional< CipherSuitegetCipher () const override
 
std::vector< SignatureSchemegetSupportedSigSchemes () const override
 
Buf getEkm (folly::StringPiece label, const Buf &hashedContext, uint16_t length) const override
 
virtual Buf getEarlyEkm (folly::StringPiece label, const Buf &hashedContext, uint16_t length) const
 
const CertgetPeerCertificate () const override
 
const CertgetSelfCertificate () const override
 
- Public Member Functions inherited from fizz::AsyncFizzBase
 AsyncFizzBase (folly::AsyncTransportWrapper::UniquePtr transport)
 
 ~AsyncFizzBase () override
 
ReadCallbackgetReadCallback () const override
 
void setReadCB (ReadCallback *callback) override
 
void writeChain (folly::AsyncTransportWrapper::WriteCallback *callback, std::unique_ptr< folly::IOBuf > &&buf, folly::WriteFlags flags=folly::WriteFlags::NONE) override
 
size_t getAppBytesWritten () const override
 
size_t getAppBytesReceived () const override
 
void destroy () override
 
std::string getSecurityProtocol () const override
 
void attachTimeoutManager (folly::TimeoutManager *manager)
 
void detachTimeoutManager ()
 
void detachEventBase () override
 
- Public Member Functions inherited from folly::WriteChainAsyncTransportWrapper< folly::AsyncTransportWrapper >
void write (folly::AsyncTransportWrapper::WriteCallback *callback, const void *buf, size_t bytes, folly::WriteFlags flags=folly::WriteFlags::NONE) override
 
void writev (folly::AsyncTransportWrapper::WriteCallback *callback, const iovec *vec, size_t count, folly::WriteFlags flags=folly::WriteFlags::NONE) override
 
- Public Member Functions inherited from folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >
 DecoratedAsyncTransportWrapper (typename folly::AsyncTransportWrapper::UniquePtr transport)
 
const AsyncTransportWrappergetWrappedTransport () const override
 
ReadCallbackgetReadCallback () const override
 
void setReadCB (folly::AsyncTransportWrapper::ReadCallback *callback) override
 
folly::EventBasegetEventBase () const override
 
void attachEventBase (folly::EventBase *eventBase) override
 
void close () override
 
void closeNow () override
 
void closeWithReset () override
 
bool connecting () const override
 
void detachEventBase () override
 
bool error () const override
 
size_t getAppBytesReceived () const override
 
size_t getAppBytesWritten () const override
 
void getLocalAddress (folly::SocketAddress *address) const override
 
void getPeerAddress (folly::SocketAddress *address) const override
 
folly::ssl::X509UniquePtr getPeerCert () const override
 
size_t getRawBytesReceived () const override
 
size_t getRawBytesWritten () const override
 
uint32_t getSendTimeout () const override
 
bool good () const override
 
bool isDetachable () const override
 
bool isEorTrackingEnabled () const override
 
bool readable () const override
 
bool writable () const override
 
void setEorTracking (bool track) override
 
void setSendTimeout (uint32_t timeoutInMs) override
 
void shutdownWrite () override
 
void shutdownWriteNow () override
 
std::string getApplicationProtocol () const noexceptoverride
 
std::string getSecurityProtocol () const override
 
bool isReplaySafe () const override
 
void setReplaySafetyCallback (folly::AsyncTransport::ReplaySafetyCallback *callback) override
 
const AsyncTransportCertificategetPeerCertificate () const override
 
const AsyncTransportCertificategetSelfCertificate () const override
 
- Public Member Functions inherited from folly::AsyncTransportWrapper
template<class T >
const TgetUnderlyingTransport () const
 
template<class T >
TgetUnderlyingTransport ()
 
- Public Member Functions inherited from folly::AsyncTransport
virtual bool isPending () const
 
SocketAddress getLocalAddress () const
 
void getAddress (SocketAddress *address) const override
 
SocketAddress getPeerAddress () const
 
- Public Member Functions inherited from folly::DelayedDestruction
bool getDestroyPending () const
 
- Public Member Functions inherited from folly::DelayedDestructionBase
virtual ~DelayedDestructionBase ()=default
 
- Public Member Functions inherited from folly::AsyncSocketBase
virtual ~AsyncSocketBase ()=default
 

Protected Member Functions

void writeAppData (folly::AsyncTransportWrapper::WriteCallback *callback, std::unique_ptr< folly::IOBuf > &&buf, folly::WriteFlags flags=folly::WriteFlags::NONE) override
 
void transportError (const folly::AsyncSocketException &ex) override
 
void transportDataAvailable () override
 
- Protected Member Functions inherited from fizz::AsyncFizzBase
virtual void startTransportReads ()
 
virtual void startHandshakeTimeout (std::chrono::milliseconds)
 
virtual void cancelHandshakeTimeout ()
 
virtual void deliverAppData (std::unique_ptr< folly::IOBuf > buf)
 
virtual void deliverError (const folly::AsyncSocketException &ex, bool closeTransport=true)
 
- Protected Member Functions inherited from folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >
 ~DecoratedAsyncTransportWrapper () override
 
- Protected Member Functions inherited from folly::AsyncTransport
 ~AsyncTransport () override=default
 
- Protected Member Functions inherited from folly::DelayedDestruction
 ~DelayedDestruction () override=default
 
 DelayedDestruction ()
 
- Protected Member Functions inherited from folly::DelayedDestructionBase
 DelayedDestructionBase ()
 
uint32_t getDestructorGuardCount () const
 
- Protected Member Functions inherited from folly::AsyncReader
virtual ~AsyncReader ()=default
 
- Protected Member Functions inherited from folly::AsyncWriter
virtual ~AsyncWriter ()=default
 
- Protected Member Functions inherited from folly::AsyncWriter::WriteCallback
virtual ~WriteCallback ()=default
 

Private Member Functions

void deliverAllErrors (const folly::AsyncSocketException &ex, bool closeTransport=true)
 
void deliverHandshakeError (folly::exception_wrapper ex)
 

Private Attributes

HandshakeCallbackhandshakeCallback_ {nullptr}
 
std::shared_ptr< FizzServerContextfizzContext_
 
std::shared_ptr< ServerExtensionsextensions_
 
State state_
 
ActionMoveVisitor visitor_
 
FizzServer< ActionMoveVisitor, SM > fizzServer_
 

Additional Inherited Members

- Protected Attributes inherited from fizz::AsyncFizzBase
folly::IOBufQueue transportReadBuf_ {folly::IOBufQueue::cacheChainLength()}
 
- Protected Attributes inherited from folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >
folly::AsyncTransportWrapper::UniquePtr transport_
 

Detailed Description

template<typename SM>
class fizz::server::AsyncFizzServerT< SM >

Definition at line 21 of file AsyncFizzServer.h.

Member Typedef Documentation

Definition at line 38 of file AsyncFizzServer.h.

Constructor & Destructor Documentation

template<typename SM >
fizz::server::AsyncFizzServerT< SM >::AsyncFizzServerT ( folly::AsyncTransportWrapper::UniquePtr  socket,
const std::shared_ptr< FizzServerContext > &  fizzContext,
const std::shared_ptr< ServerExtensions > &  extensions = nullptr 
)

Definition at line 15 of file AsyncFizzServer-inl.h.

20  fizzContext_(fizzContext),
21  extensions_(extensions),
22  visitor_(*this),
folly::IOBufQueue transportReadBuf_
FizzServer< ActionMoveVisitor, SM > fizzServer_
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
AsyncFizzBase(folly::AsyncTransportWrapper::UniquePtr transport)
NetworkSocket socket(int af, int type, int protocol)
Definition: NetOps.cpp:412
std::shared_ptr< ServerExtensions > extensions_
std::shared_ptr< FizzServerContext > fizzContext_

Member Function Documentation

template<typename SM >
void fizz::server::AsyncFizzServerT< SM >::attachEventBase ( folly::EventBase eventBase)
overridevirtual

Attach the transport to a EventBase.

This may only be called if the transport is not currently attached to a EventBase (by an earlier call to detachEventBase()).

This method must be invoked in the EventBase's thread.

Reimplemented from fizz::AsyncFizzBase.

Definition at line 59 of file AsyncFizzServer-inl.h.

References fizz::AsyncFizzBase::attachEventBase(), fizz::server::State::executor(), and fizz::server::AsyncFizzServerT< SM >::state_.

59  {
60  state_.executor() = evb;
62 }
void attachEventBase(folly::EventBase *eventBase) override
folly::Executor * executor() const
Definition: State.h:76
template<typename SM >
void fizz::server::AsyncFizzServerT< SM >::close ( )
overridevirtual

Close the transport.

This gracefully closes the transport, waiting for all pending write requests to complete before actually closing the underlying transport.

If a read callback is set, readEOF() will be called immediately. If there are outstanding write requests, the close will be delayed until all remaining writes have completed. No new writes may be started after close() has been called.

Implements folly::AsyncTransport.

Definition at line 116 of file AsyncFizzServer-inl.h.

References fizz::server::AsyncFizzServerT< SM >::deliverAllErrors(), folly::AsyncSocketException::END_OF_FILE, fizz::server::AsyncFizzServerT< SM >::fizzServer_, and folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::transport_.

116  {
117  if (transport_->good()) {
118  fizzServer_.appClose();
119  } else {
120  DelayedDestruction::DestructorGuard dg(this);
122  folly::AsyncSocketException::END_OF_FILE, "socket closed locally");
123  deliverAllErrors(ase, false);
124  transport_->close();
125  }
126 }
FizzServer< ActionMoveVisitor, SM > fizzServer_
void deliverAllErrors(const folly::AsyncSocketException &ex, bool closeTransport=true)
template<typename SM >
void fizz::server::AsyncFizzServerT< SM >::closeNow ( )
overridevirtual

Close the transport immediately.

This closes the transport immediately, dropping any outstanding data waiting to be written.

If a read callback is set, readEOF() will be called immediately. If there are outstanding write requests, these requests will be aborted and writeError() will be invoked immediately on all outstanding write callbacks.

Implements folly::AsyncTransport.

Definition at line 141 of file AsyncFizzServer-inl.h.

References fizz::server::AsyncFizzServerT< SM >::deliverAllErrors(), folly::AsyncSocketException::END_OF_FILE, fizz::server::AsyncFizzServerT< SM >::fizzServer_, and folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::transport_.

141  {
142  DelayedDestruction::DestructorGuard dg(this);
143  if (transport_->good()) {
144  fizzServer_.appClose();
145  }
147  folly::AsyncSocketException::END_OF_FILE, "socket closed locally");
148  deliverAllErrors(ase, false);
149  transport_->closeNow();
150 }
FizzServer< ActionMoveVisitor, SM > fizzServer_
void deliverAllErrors(const folly::AsyncSocketException &ex, bool closeTransport=true)
template<typename SM >
void fizz::server::AsyncFizzServerT< SM >::closeWithReset ( )
overridevirtual

Reset the transport immediately.

This closes the transport immediately, sending a reset to the remote peer if possible to indicate abnormal shutdown.

Note that not all subclasses implement this reset functionality: some subclasses may treat reset() the same as closeNow(). Subclasses that use TCP transports should terminate the connection with a TCP reset.

Reimplemented from folly::AsyncTransport.

Definition at line 129 of file AsyncFizzServer-inl.h.

References fizz::server::AsyncFizzServerT< SM >::deliverAllErrors(), folly::AsyncSocketException::END_OF_FILE, fizz::server::AsyncFizzServerT< SM >::fizzServer_, and folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::transport_.

129  {
130  DelayedDestruction::DestructorGuard dg(this);
131  if (transport_->good()) {
132  fizzServer_.appClose();
133  }
135  folly::AsyncSocketException::END_OF_FILE, "socket closed locally");
136  deliverAllErrors(ase, false);
137  transport_->closeWithReset();
138 }
FizzServer< ActionMoveVisitor, SM > fizzServer_
void deliverAllErrors(const folly::AsyncSocketException &ex, bool closeTransport=true)
template<typename SM >
bool fizz::server::AsyncFizzServerT< SM >::connecting ( ) const
overridevirtual

Determine if transport is connected to the endpoint

Returns
false iff the transport is connected, otherwise true

Implements fizz::AsyncFizzBase.

Definition at line 44 of file AsyncFizzServer-inl.h.

References fizz::server::AsyncFizzServerT< SM >::handshakeCallback_, and folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::transport_.

44  {
45  return handshakeCallback_ || transport_->connecting();
46 }
HandshakeCallback * handshakeCallback_
template<typename SM >
void fizz::server::AsyncFizzServerT< SM >::deliverHandshakeError ( folly::exception_wrapper  ex)
private
template<typename SM >
bool fizz::server::AsyncFizzServerT< SM >::error ( ) const
overridevirtual

Determine if an error has occurred with this transport.

Returns
true iff an error has occurred (not EOF).

Implements fizz::AsyncFizzBase.

Definition at line 49 of file AsyncFizzServer-inl.h.

References fizz::server::AsyncFizzServerT< SM >::fizzServer_, and folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::transport_.

Referenced by fizz::server::AsyncFizzServerT< SM >::good(), and fizz::server::AsyncFizzServerT< SM >::writeAppData().

49  {
50  return transport_->error() || fizzServer_.inErrorState();
51 }
FizzServer< ActionMoveVisitor, SM > fizzServer_
template<typename SM >
std::string fizz::server::AsyncFizzServerT< SM >::getApplicationProtocol ( ) const
overridevirtualnoexcept

Return the application protocol being used by the underlying transport protocol. This is useful for transports which are used to tunnel other protocols.

Implements fizz::AsyncFizzBase.

Definition at line 107 of file AsyncFizzServer-inl.h.

References alpn, fizz::server::State::alpn(), and fizz::server::AsyncFizzServerT< SM >::getState().

107  {
108  if (getState().alpn()) {
109  return *getState().alpn();
110  } else {
111  return "";
112  }
113 }
StringPiece alpn
const State & getState() const
const folly::Optional< std::string > & alpn() const
Definition: State.h:168
template<typename SM >
folly::Optional< CipherSuite > fizz::server::AsyncFizzServerT< SM >::getCipher ( ) const
overridevirtual

Get the CipherSuite negotiated in this transport.

Implements fizz::AsyncFizzBase.

Definition at line 153 of file AsyncFizzServer-inl.h.

References fizz::server::State::cipher(), and fizz::server::AsyncFizzServerT< SM >::getState().

Referenced by fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().

153  {
154  return getState().cipher();
155 }
const State & getState() const
folly::Optional< CipherSuite > cipher() const
Definition: State.h:111
template<typename SM >
Buf fizz::server::AsyncFizzServerT< SM >::getEarlyEkm ( folly::StringPiece  label,
const Buf hashedContext,
uint16_t  length 
) const
virtual

Definition at line 172 of file AsyncFizzServer-inl.h.

References fizz::server::AsyncFizzServerT< SM >::fizzServer_.

Referenced by fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().

175  {
176  return fizzServer_.getEarlyEkm(label, context, length);
177 }
FizzServer< ActionMoveVisitor, SM > fizzServer_
context
Definition: CMakeCache.txt:563
template<typename SM >
Buf fizz::server::AsyncFizzServerT< SM >::getEkm ( folly::StringPiece  label,
const Buf context,
uint16_t  length 
) const
overridevirtual

Get the exported material.

Implements fizz::AsyncFizzBase.

Definition at line 164 of file AsyncFizzServer-inl.h.

References fizz::server::AsyncFizzServerT< SM >::fizzServer_.

Referenced by fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().

167  {
168  return fizzServer_.getEkm(label, context, length);
169 }
FizzServer< ActionMoveVisitor, SM > fizzServer_
context
Definition: CMakeCache.txt:563
template<typename SM >
folly::ssl::X509UniquePtr fizz::server::AsyncFizzServerT< SM >::getPeerCert ( ) const
overridevirtual

Information about the current security state. To be implemented by derived classes.

Implements fizz::AsyncFizzBase.

Definition at line 65 of file AsyncFizzServer-inl.h.

References fizz::server::AsyncFizzServerT< SM >::getPeerCertificate().

65  {
66  auto cert = getPeerCertificate();
67  if (cert) {
68  return cert->getX509();
69  } else {
70  return nullptr;
71  }
72 }
const Cert * getPeerCertificate() const override
template<typename SM >
const Cert * fizz::server::AsyncFizzServerT< SM >::getPeerCertificate ( ) const
overridevirtual

Get the certificates in fizz::Cert form.

Implements fizz::AsyncFizzBase.

Definition at line 85 of file AsyncFizzServer-inl.h.

References fizz::server::State::clientCert(), and fizz::server::AsyncFizzServerT< SM >::getState().

Referenced by fizz::server::AsyncFizzServerT< SM >::getPeerCert(), and fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().

85  {
86  return getState().clientCert().get();
87 }
const State & getState() const
const std::shared_ptr< const Cert > & clientCert() const
Definition: State.h:97
template<typename SM >
const X509 * fizz::server::AsyncFizzServerT< SM >::getSelfCert ( ) const
overridevirtual

The local certificate used for this connection. May be null

Implements fizz::AsyncFizzBase.

Definition at line 75 of file AsyncFizzServer-inl.h.

References fizz::server::AsyncFizzServerT< SM >::getSelfCertificate().

75  {
76  auto cert = getSelfCertificate();
77  if (cert) {
78  return cert->getX509().get();
79  } else {
80  return nullptr;
81  }
82 }
const Cert * getSelfCertificate() const override
template<typename SM >
const Cert * fizz::server::AsyncFizzServerT< SM >::getSelfCertificate ( ) const
overridevirtual

Get the certificate information of this transport, if any

Implements fizz::AsyncFizzBase.

Definition at line 90 of file AsyncFizzServer-inl.h.

References fizz::server::AsyncFizzServerT< SM >::getState(), and fizz::server::State::serverCert().

Referenced by fizz::server::AsyncFizzServerT< SM >::getSelfCert(), and fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().

90  {
91  return getState().serverCert().get();
92 }
const State & getState() const
std::shared_ptr< const Cert > serverCert() const
Definition: State.h:90
template<typename SM >
std::vector< SignatureScheme > fizz::server::AsyncFizzServerT< SM >::getSupportedSigSchemes ( ) const
overridevirtual

Get the supported signature schemes in this transport.

Implements fizz::AsyncFizzBase.

Definition at line 158 of file AsyncFizzServer-inl.h.

References fizz::server::State::context(), fizz::server::AsyncFizzServerT< SM >::getState(), and fizz::server::FizzServerContext::getSupportedSigSchemes().

Referenced by fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().

159  {
161 }
const auto & getSupportedSigSchemes() const
const State & getState() const
const FizzServerContext * context() const
Definition: State.h:83
template<typename SM >
bool fizz::server::AsyncFizzServerT< SM >::good ( ) const
overridevirtual

Information about the current transport state. To be implemented by derived classes.

Implements fizz::AsyncFizzBase.

Definition at line 34 of file AsyncFizzServer-inl.h.

References fizz::server::AsyncFizzServerT< SM >::error(), and folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::transport_.

34  {
35  return !error() && transport_->good();
36 }
template<typename SM >
bool fizz::server::AsyncFizzServerT< SM >::isDetachable ( ) const
overridevirtual

Determine if the transport can be detached.

This method must be called from the current EventBase's thread.

Reimplemented from fizz::AsyncFizzBase.

Definition at line 54 of file AsyncFizzServer-inl.h.

References fizz::server::AsyncFizzServerT< SM >::fizzServer_, and fizz::AsyncFizzBase::isDetachable().

54  {
55  return !fizzServer_.actionProcessing() && AsyncFizzBase::isDetachable();
56 }
FizzServer< ActionMoveVisitor, SM > fizzServer_
bool isDetachable() const override
template<typename SM >
bool fizz::server::AsyncFizzServerT< SM >::isReplaySafe ( ) const
overridevirtual

False if the transport does not have replay protection, but will in the future.

Implements fizz::AsyncFizzBase.

Definition at line 95 of file AsyncFizzServer-inl.h.

95  {
96  // Server always provides replay protection.
97  return true;
98 }
template<typename SM >
bool fizz::server::AsyncFizzServerT< SM >::readable ( ) const
overridevirtual

Determine if the transport is readable or not.

Returns
true iff the transport is readable, false otherwise.

Implements fizz::AsyncFizzBase.

Definition at line 39 of file AsyncFizzServer-inl.h.

References folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::transport_.

39  {
40  return transport_->readable();
41 }
template<typename SM >
void fizz::server::AsyncFizzServerT< SM >::setReplaySafetyCallback ( folly::AsyncTransport::ReplaySafetyCallback callback)
overridevirtual

Set the ReplaySafeCallback on this transport.

This should only be called if isReplaySafe() returns false.

Implements fizz::AsyncFizzBase.

Definition at line 101 of file AsyncFizzServer-inl.h.

102  {
103  LOG(FATAL) << "setReplaySafetyCallback() called on replay safe transport";
104 }
template<typename SM >
void fizz::server::AsyncFizzServerT< SM >::transportDataAvailable ( )
overrideprotectedvirtual

Alert the derived class that additional data is available in transportReadBuf_.

Implements fizz::AsyncFizzBase.

Definition at line 210 of file AsyncFizzServer-inl.h.

References fizz::server::AsyncFizzServerT< SM >::fizzServer_.

Referenced by fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().

210  {
211  fizzServer_.newTransportData();
212 }
FizzServer< ActionMoveVisitor, SM > fizzServer_
template<typename SM >
void fizz::server::AsyncFizzServerT< SM >::transportError ( const folly::AsyncSocketException ex)
overrideprotectedvirtual

Alert the derived class that a transport error occured.

Implements fizz::AsyncFizzBase.

Definition at line 203 of file AsyncFizzServer-inl.h.

References fizz::server::AsyncFizzServerT< SM >::deliverAllErrors().

Referenced by fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().

204  {
205  DelayedDestruction::DestructorGuard dg(this);
206  deliverAllErrors(ex);
207 }
void deliverAllErrors(const folly::AsyncSocketException &ex, bool closeTransport=true)
template<typename SM >
void fizz::server::AsyncFizzServerT< SM >::writeAppData ( folly::AsyncTransportWrapper::WriteCallback callback,
std::unique_ptr< folly::IOBuf > &&  buf,
folly::WriteFlags  flags = folly::WriteFlags::NONE 
)
overrideprotectedvirtual

Interface for the derived class to implement to receive app data from the app layer.

Implements fizz::AsyncFizzBase.

Definition at line 180 of file AsyncFizzServer-inl.h.

References fizz::AppWrite::callback, fizz::AppWrite::data, fizz::server::AsyncFizzServerT< SM >::error(), fizz::server::AsyncFizzServerT< SM >::fizzServer_, fizz::AppWrite::flags, folly::AsyncSocketException::INVALID_STATE, folly::gen::move, folly::WriteChainAsyncTransportWrapper< folly::AsyncTransportWrapper >::write(), and folly::AsyncWriter::WriteCallback::writeErr().

Referenced by fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().

183  {
184  if (error()) {
185  if (callback) {
186  callback->writeErr(
187  0,
190  "fizz app write in error state"));
191  }
192  return;
193  }
194 
195  AppWrite write;
196  write.callback = callback;
197  write.data = std::move(buf);
198  write.flags = flags;
199  fizzServer_.appWrite(std::move(write));
200 }
flags
Definition: http_parser.h:127
FizzServer< ActionMoveVisitor, SM > fizzServer_
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
void write(folly::AsyncTransportWrapper::WriteCallback *callback, const void *buf, size_t bytes, folly::WriteFlags flags=folly::WriteFlags::NONE) override
virtual void writeErr(size_t bytesWritten, const AsyncSocketException &ex) noexcept=0

Member Data Documentation

template<typename SM>
std::shared_ptr<ServerExtensions> fizz::server::AsyncFizzServerT< SM >::extensions_
private

Definition at line 127 of file AsyncFizzServer.h.

Referenced by fizz::server::AsyncFizzServerT< SM >::accept().

template<typename SM>
std::shared_ptr<FizzServerContext> fizz::server::AsyncFizzServerT< SM >::fizzContext_
private

Definition at line 125 of file AsyncFizzServer.h.

Referenced by fizz::server::AsyncFizzServerT< SM >::accept().

template<typename SM>
ActionMoveVisitor fizz::server::AsyncFizzServerT< SM >::visitor_
private

Definition at line 131 of file AsyncFizzServer.h.


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