proxygen
|
#include <DecoratedAsyncTransportWrapper.h>
Public Member Functions | |
DecoratedAsyncTransportWrapper (typename T::UniquePtr transport) | |
const AsyncTransportWrapper * | getWrappedTransport () const override |
ReadCallback * | getReadCallback () const override |
void | setReadCB (folly::AsyncTransportWrapper::ReadCallback *callback) override |
void | write (folly::AsyncTransportWrapper::WriteCallback *callback, const void *buf, size_t bytes, folly::WriteFlags flags=folly::WriteFlags::NONE) override |
void | writeChain (folly::AsyncTransportWrapper::WriteCallback *callback, std::unique_ptr< folly::IOBuf > &&buf, folly::WriteFlags flags=folly::WriteFlags::NONE) override |
void | writev (folly::AsyncTransportWrapper::WriteCallback *callback, const iovec *vec, size_t bytes, folly::WriteFlags flags=folly::WriteFlags::NONE) override |
folly::EventBase * | getEventBase () 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 AsyncTransportCertificate * | getPeerCertificate () const override |
const AsyncTransportCertificate * | getSelfCertificate () const override |
Public Member Functions inherited from folly::AsyncTransportWrapper | |
template<class T > | |
const T * | getUnderlyingTransport () const |
template<class T > | |
T * | getUnderlyingTransport () |
Public Member Functions inherited from folly::AsyncTransport | |
virtual bool | isPending () const |
SocketAddress | getLocalAddress () const |
void | getAddress (SocketAddress *address) const override |
SocketAddress | getPeerAddress () const |
virtual const X509 * | getSelfCert () const |
Public Member Functions inherited from folly::DelayedDestruction | |
virtual void | destroy () |
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 | |
~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 Attributes | |
T::UniquePtr | transport_ |
Additional Inherited Members | |
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, Destructor > | UniquePtr |
Convenience class so that AsyncTransportWrapper can be decorated without having to redefine every single method.
Definition at line 27 of file DecoratedAsyncTransportWrapper.h.
|
inlineexplicit |
Definition at line 29 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverrideprotected |
Definition at line 201 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
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.
Implements folly::AsyncTransport.
Definition at line 75 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
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 79 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
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 83 of file DecoratedAsyncTransportWrapper.h.
Referenced by folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::closeWithReset().
|
inlineoverridevirtual |
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 87 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Determine if transport is connected to the endpoint
Implements folly::AsyncTransport.
Definition at line 95 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Detach the transport from its EventBase.
This may only be called when the transport is idle and has no reads or writes pending. Once detached, the transport may not be used again until it is re-attached to a EventBase by calling attachEventBase().
This method must be called from the current EventBase's thread.
Implements folly::AsyncTransport.
Definition at line 99 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Determine if an error has occurred with this transport.
Implements folly::AsyncTransport.
Definition at line 103 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Implements folly::AsyncTransport.
Definition at line 107 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Implements folly::AsyncTransport.
Definition at line 111 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtualnoexcept |
Return the application protocol being used by the underlying transport protocol. This is useful for transports which are used to tunnel other protocols.
Reimplemented from folly::AsyncTransport.
Definition at line 175 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Implements folly::AsyncSocketBase.
Definition at line 70 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Get the address of the local endpoint of this transport.
This function may throw AsyncSocketException on error.
address | The local address will be stored in the specified SocketAddress. |
Implements folly::AsyncTransport.
Definition at line 115 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Get the address of the remote endpoint to which this transport is connected.
This function may throw AsyncSocketException on error.
address | The remote endpoint's address will be stored in the specified SocketAddress. |
Implements folly::AsyncTransport.
Definition at line 119 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Get the certificate used to authenticate the peer.
Reimplemented from folly::AsyncTransport.
Definition at line 123 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Get the peer certificate information if any
Reimplemented from folly::AsyncTransport.
Definition at line 192 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Implements folly::AsyncTransport.
Definition at line 127 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Implements folly::AsyncTransport.
Definition at line 131 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Implements folly::AsyncTransportWrapper.
Definition at line 37 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Returns the name of the security protocol being used.
Reimplemented from folly::AsyncTransport.
Definition at line 179 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Get the certificate information of this transport, if any
Reimplemented from folly::AsyncTransport.
Definition at line 196 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Get the send timeout.
Implements folly::AsyncTransport.
Definition at line 135 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
The transport wrapper may wrap another transport. This returns the transport that is wrapped. It returns nullptr if there is no wrapped transport.
Reimplemented from folly::AsyncTransportWrapper.
Definition at line 32 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Determine if transport is open and ready to read or write.
Note that this function returns false on EOF; you must also call error() to distinguish between an EOF and an error.
Implements folly::AsyncTransport.
Definition at line 139 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Determine if the transport can be detached.
This method must be called from the current EventBase's thread.
Implements folly::AsyncTransport.
Definition at line 143 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Implements folly::AsyncTransport.
Definition at line 147 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
False if the transport does not have replay protection, but will in the future.
Reimplemented from folly::AsyncTransport.
Definition at line 183 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Determine if the transport is readable or not.
Implements folly::AsyncTransport.
Definition at line 151 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Implements folly::AsyncTransport.
Definition at line 159 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Implements folly::AsyncTransportWrapper.
Definition at line 41 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Set the ReplaySafeCallback on this transport.
This should only be called if isReplaySafe() returns false.
Reimplemented from folly::AsyncTransport.
Definition at line 187 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Set the send timeout.
If write requests do not make any progress for more than the specified number of milliseconds, fail all pending writes and close the transport.
If write requests are currently pending when setSendTimeout() is called, the timeout interval is immediately restarted using the new value.
milliseconds | The timeout duration, in milliseconds. If 0, no timeout will be used. |
Implements folly::AsyncTransport.
Definition at line 163 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Perform a half-shutdown of the write side of the transport.
The caller should not make any more calls to write() or writev() after shutdownWrite() is called. Any future write attempts will fail immediately.
Not all transport types support half-shutdown. If the underlying transport does not support half-shutdown, it will fully shutdown both the read and write sides of the transport. (Fully shutting down the socket is better than doing nothing at all, since the caller may rely on the shutdownWrite() call to notify the other end of the connection that no more data can be read.)
If there is pending data still waiting to be written on the transport, the actual shutdown will be delayed until the pending data has been written.
Note: There is no corresponding shutdownRead() equivalent. Simply uninstall the read callback if you wish to stop reading. (On TCP sockets at least, shutting down the read side of the socket is a no-op anyway.)
Implements folly::AsyncTransport.
Definition at line 167 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Perform a half-shutdown of the write side of the transport.
shutdownWriteNow() is identical to shutdownWrite(), except that it immediately performs the shutdown, rather than waiting for pending writes to complete. Any pending write requests will be immediately failed when shutdownWriteNow() is called.
Implements folly::AsyncTransport.
Definition at line 171 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
Determine if the transport is writable or not.
Reimplemented from folly::AsyncTransport.
Definition at line 155 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
If you supply a non-null WriteCallback, exactly one of writeSuccess() or writeErr() will be invoked when the write completes. If you supply the same WriteCallback object for multiple write() calls, it will be invoked exactly once per call. The only way to cancel outstanding write requests is to close the socket (e.g., with closeNow() or shutdownWriteNow()). When closing the socket this way, writeErr() will still be invoked once for each outstanding write operation.
Implements folly::AsyncTransportWrapper.
Reimplemented in folly::WriteChainAsyncTransportWrapper< T >, and folly::WriteChainAsyncTransportWrapper< folly::AsyncTransportWrapper >.
Definition at line 46 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
If you supply a non-null WriteCallback, exactly one of writeSuccess() or writeErr() will be invoked when the write completes. If you supply the same WriteCallback object for multiple write() calls, it will be invoked exactly once per call. The only way to cancel outstanding write requests is to close the socket (e.g., with closeNow() or shutdownWriteNow()). When closing the socket this way, writeErr() will still be invoked once for each outstanding write operation.
Implements folly::AsyncTransportWrapper.
Reimplemented in folly::WriteChainAsyncTransportWrapper< T >, and folly::WriteChainAsyncTransportWrapper< folly::AsyncTransportWrapper >.
Definition at line 54 of file DecoratedAsyncTransportWrapper.h.
|
inlineoverridevirtual |
If you supply a non-null WriteCallback, exactly one of writeSuccess() or writeErr() will be invoked when the write completes. If you supply the same WriteCallback object for multiple write() calls, it will be invoked exactly once per call. The only way to cancel outstanding write requests is to close the socket (e.g., with closeNow() or shutdownWriteNow()). When closing the socket this way, writeErr() will still be invoked once for each outstanding write operation.
Implements folly::AsyncTransportWrapper.
Reimplemented in folly::WriteChainAsyncTransportWrapper< T >, and folly::WriteChainAsyncTransportWrapper< folly::AsyncTransportWrapper >.
Definition at line 61 of file DecoratedAsyncTransportWrapper.h.
|
protected |
Definition at line 203 of file DecoratedAsyncTransportWrapper.h.
Referenced by folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::attachEventBase(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::close(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::closeNow(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::closeWithReset(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::connecting(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::detachEventBase(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::error(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::getAppBytesReceived(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::getAppBytesWritten(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::getApplicationProtocol(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::getEventBase(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::getLocalAddress(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::getPeerAddress(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::getPeerCert(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::getPeerCertificate(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::getRawBytesReceived(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::getRawBytesWritten(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::getReadCallback(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::getSecurityProtocol(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::getSelfCertificate(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::getSendTimeout(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::getWrappedTransport(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::good(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::isDetachable(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::isEorTrackingEnabled(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::isReplaySafe(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::readable(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::setEorTracking(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::setReadCB(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::setReplaySafetyCallback(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::setSendTimeout(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::shutdownWrite(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::shutdownWriteNow(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::writable(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::write(), folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::writeChain(), and folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::writev().