proxygen
WriteCallback Class Reference

#include <AsyncSocketTest.h>

Inheritance diagram for WriteCallback:
folly::AsyncWriter::WriteCallback

Public Member Functions

 WriteCallback ()
 
void writeSuccess () noexceptoverride
 
void writeErr (size_t nBytesWritten, const folly::AsyncSocketException &ex) noexceptoverride
 
- Public Member Functions inherited from folly::AsyncWriter::WriteCallback
virtual ~WriteCallback ()=default
 

Public Attributes

StateEnum state
 
std::atomic< size_t > bytesWritten
 
folly::AsyncSocketException exception
 
VoidCallback successCallback
 
VoidCallback errorCallback
 

Detailed Description

Definition at line 55 of file AsyncSocketTest.h.

Constructor & Destructor Documentation

WriteCallback::WriteCallback ( )
inline

Definition at line 57 of file AsyncSocketTest.h.

Member Function Documentation

void WriteCallback::writeErr ( size_t  bytesWritten,
const folly::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 69 of file AsyncSocketTest.h.

References ConnCallback::errorCallback, ConnCallback::exception, and STATE_FAILED.

71  {
72  LOG(ERROR) << ex.what();
74  this->bytesWritten = nBytesWritten;
75  exception = ex;
76  if (errorCallback) {
77  errorCallback();
78  }
79  }
folly::AsyncSocketException exception
VoidCallback errorCallback
state
Definition: http_parser.c:272
std::atomic< size_t > bytesWritten
void WriteCallback::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 62 of file AsyncSocketTest.h.

References STATE_SUCCEEDED, and ConnCallback::successCallback.

62  {
64  if (successCallback) {
66  }
67  }
VoidCallback successCallback
state
Definition: http_parser.c:272

Member Data Documentation

std::atomic<size_t> WriteCallback::bytesWritten

Definition at line 82 of file AsyncSocketTest.h.

Referenced by TEST().

VoidCallback WriteCallback::errorCallback

Definition at line 85 of file AsyncSocketTest.h.

folly::AsyncSocketException WriteCallback::exception

Definition at line 83 of file AsyncSocketTest.h.

Referenced by TEST().

StateEnum WriteCallback::state

Definition at line 81 of file AsyncSocketTest.h.

Referenced by TEST(), TEST_P(), and testConnectOptWrite().

VoidCallback WriteCallback::successCallback

Definition at line 84 of file AsyncSocketTest.h.

Referenced by TEST(), and testConnectOptWrite().


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