proxygen
DelayedWrite Class Reference
Inheritance diagram for DelayedWrite:
folly::AsyncTimeout

Public Member Functions

 DelayedWrite (const std::shared_ptr< AsyncSocket > &socket, unique_ptr< IOBuf > &&bufs, AsyncTransportWrapper::WriteCallback *wcb, bool cork, bool lastWrite=false)
 
- Public Member Functions inherited from folly::AsyncTimeout
 AsyncTimeout (TimeoutManager *timeoutManager)
 
 AsyncTimeout (EventBase *eventBase)
 
 AsyncTimeout (TimeoutManager *timeoutManager, InternalEnum internal)
 
 AsyncTimeout (EventBase *eventBase, InternalEnum internal)
 
 AsyncTimeout ()
 
virtual ~AsyncTimeout ()
 
bool scheduleTimeout (uint32_t milliseconds)
 
bool scheduleTimeout (TimeoutManager::timeout_type timeout)
 
void cancelTimeout ()
 
bool isScheduled () const
 
void attachTimeoutManager (TimeoutManager *timeoutManager, InternalEnum internal=InternalEnum::NORMAL)
 
void attachEventBase (EventBase *eventBase, InternalEnum internal=InternalEnum::NORMAL)
 
void detachTimeoutManager ()
 
void detachEventBase ()
 
const TimeoutManagergetTimeoutManager ()
 
struct event * getEvent ()
 

Private Member Functions

void timeoutExpired () noexceptoverride
 

Private Attributes

std::shared_ptr< AsyncSocketsocket_
 
unique_ptr< IOBufbufs_
 
AsyncTransportWrapper::WriteCallbackwcb_
 
bool cork_
 
bool lastWrite_
 

Additional Inherited Members

- Public Types inherited from folly::AsyncTimeout
typedef TimeoutManager::InternalEnum InternalEnum
 
- Static Public Member Functions inherited from folly::AsyncTimeout
template<typename TCallback >
static std::unique_ptr< AsyncTimeoutmake (TimeoutManager &manager, TCallback &&callback)
 
template<typename TCallback >
static std::unique_ptr< AsyncTimeoutschedule (TimeoutManager::timeout_type timeout, TimeoutManager &manager, TCallback &&callback)
 

Detailed Description

Definition at line 58 of file AsyncSocketTest2.cpp.

Constructor & Destructor Documentation

DelayedWrite::DelayedWrite ( const std::shared_ptr< AsyncSocket > &  socket,
unique_ptr< IOBuf > &&  bufs,
AsyncTransportWrapper::WriteCallback wcb,
bool  cork,
bool  lastWrite = false 
)
inline

Definition at line 60 of file AsyncSocketTest2.cpp.

66  : AsyncTimeout(socket->getEventBase()),
67  socket_(socket),
68  bufs_(std::move(bufs)),
69  wcb_(wcb),
70  cork_(cork),
71  lastWrite_(lastWrite) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::shared_ptr< AsyncSocket > socket_
AsyncTransportWrapper::WriteCallback * wcb_
unique_ptr< IOBuf > bufs_
NetworkSocket socket(int af, int type, int protocol)
Definition: NetOps.cpp:412

Member Function Documentation

void DelayedWrite::timeoutExpired ( )
inlineoverrideprivatevirtualnoexcept

timeoutExpired() is invoked when the timeout period has expired.

Implements folly::AsyncTimeout.

Definition at line 74 of file AsyncSocketTest2.cpp.

References folly::CORK, folly::gen::move, folly::NONE, and socket_.

74  {
75  WriteFlags flags = cork_ ? WriteFlags::CORK : WriteFlags::NONE;
76  socket_->writeChain(wcb_, std::move(bufs_), flags);
77  if (lastWrite_) {
78  socket_->shutdownWrite();
79  }
80  }
flags
Definition: http_parser.h:127
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::shared_ptr< AsyncSocket > socket_
AsyncTransportWrapper::WriteCallback * wcb_
unique_ptr< IOBuf > bufs_

Member Data Documentation

unique_ptr<IOBuf> DelayedWrite::bufs_
private

Definition at line 83 of file AsyncSocketTest2.cpp.

bool DelayedWrite::cork_
private

Definition at line 85 of file AsyncSocketTest2.cpp.

bool DelayedWrite::lastWrite_
private

Definition at line 86 of file AsyncSocketTest2.cpp.

std::shared_ptr<AsyncSocket> DelayedWrite::socket_
private

Definition at line 82 of file AsyncSocketTest2.cpp.

AsyncTransportWrapper::WriteCallback* DelayedWrite::wcb_
private

Definition at line 84 of file AsyncSocketTest2.cpp.


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