proxygen
folly::WriteCallbackBase Class Reference

#include <AsyncSSLSocketTest.h>

Inheritance diagram for folly::WriteCallbackBase:
folly::AsyncWriter::WriteCallback folly::ExpectWriteErrorCallback

Public Member Functions

 WriteCallbackBase (SendMsgParamsCallbackBase *mcb=nullptr)
 
 ~WriteCallbackBase () override
 
virtual void setSocket (const std::shared_ptr< AsyncSSLSocket > &socket)
 
void writeSuccess () noexceptoverride
 
void writeErr (size_t nBytesWritten, const AsyncSocketException &ex) noexceptoverride
 
- Public Member Functions inherited from folly::AsyncWriter::WriteCallback
virtual ~WriteCallback ()=default
 

Public Attributes

std::shared_ptr< AsyncSSLSocketsocket_
 
StateEnum state
 
size_t bytesWritten
 
AsyncSocketException exception
 
SendMsgParamsCallbackBasemcb_
 

Detailed Description

Definition at line 129 of file AsyncSSLSocketTest.h.

Constructor & Destructor Documentation

folly::WriteCallbackBase::WriteCallbackBase ( SendMsgParamsCallbackBase mcb = nullptr)
inlineexplicit
folly::WriteCallbackBase::~WriteCallbackBase ( )
inlineoverride

Definition at line 137 of file AsyncSSLSocketTest.h.

References EXPECT_EQ, and folly::STATE_SUCCEEDED.

137  {
139  }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
state
Definition: http_parser.c:272

Member Function Documentation

virtual void folly::WriteCallbackBase::setSocket ( const std::shared_ptr< AsyncSSLSocket > &  socket)
inlinevirtual

Definition at line 141 of file AsyncSSLSocketTest.h.

References folly::netops::socket(), and folly::SendMsgParamsCallbackBase::socket_.

Referenced by folly::ExpectWriteErrorCallback::~ExpectWriteErrorCallback().

141  {
142  socket_ = socket;
143  if (mcb_) {
145  }
146  }
void setSocket(const std::shared_ptr< AsyncSSLSocket > &socket)
std::shared_ptr< AsyncSSLSocket > socket_
NetworkSocket socket(int af, int type, int protocol)
Definition: NetOps.cpp:412
SendMsgParamsCallbackBase * mcb_
void folly::WriteCallbackBase::writeErr ( size_t  bytesWritten,
const AsyncSocketException ex 
)
inlineoverridevirtualnoexcept

writeError() will be invoked if an error occurs writing the data.

Parameters
bytesWrittenThe number of bytes that were successfull
exAn exception describing the error that occurred.

Implements folly::AsyncWriter::WriteCallback.

Definition at line 153 of file AsyncSSLSocketTest.h.

References folly::SendMsgParamsCallbackBase::socket_, and folly::STATE_FAILED.

155  {
156  std::cerr << "writeError: bytesWritten " << nBytesWritten << ", exception "
157  << ex.what() << std::endl;
158 
160  this->bytesWritten = nBytesWritten;
161  exception = ex;
162  socket_->close();
163  }
std::shared_ptr< AsyncSSLSocket > socket_
AsyncSocketException exception
state
Definition: http_parser.c:272
void folly::WriteCallbackBase::writeSuccess ( )
inlineoverridevirtualnoexcept

writeSuccess() will be invoked when all of the data has been successfully written.

Note that this mainly signals that the buffer containing the data to write is no longer needed and may be freed or re-used. It does not guarantee that the data has been fully transmitted to the remote endpoint. For example, on socket-based transports, writeSuccess() only indicates that the data has been given to the kernel for eventual transmission.

Implements folly::AsyncWriter::WriteCallback.

Definition at line 148 of file AsyncSSLSocketTest.h.

References folly::STATE_SUCCEEDED.

148  {
149  std::cerr << "writeSuccess" << std::endl;
151  }
state
Definition: http_parser.c:272

Member Data Documentation

size_t folly::WriteCallbackBase::bytesWritten

Definition at line 167 of file AsyncSSLSocketTest.h.

AsyncSocketException folly::WriteCallbackBase::exception

Definition at line 168 of file AsyncSSLSocketTest.h.

SendMsgParamsCallbackBase* folly::WriteCallbackBase::mcb_

Definition at line 169 of file AsyncSSLSocketTest.h.

std::shared_ptr<AsyncSSLSocket> folly::WriteCallbackBase::socket_

Definition at line 165 of file AsyncSSLSocketTest.h.

StateEnum folly::WriteCallbackBase::state

Definition at line 166 of file AsyncSSLSocketTest.h.


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