proxygen
|
#include <ZeroCopy.h>
Public Member Functions | |
ZeroCopyTestServer (folly::EventBase *evb, int numLoops, size_t bufferSize, bool zeroCopy) | |
void | addCallbackToServerSocket (folly::AsyncServerSocket &sock) |
void | connectionAccepted (int fd, const folly::SocketAddress &) noexceptoverride |
void | acceptError (const std::exception &) noexceptoverride |
Public Member Functions inherited from folly::AsyncServerSocket::AcceptCallback | |
virtual | ~AcceptCallback ()=default |
virtual void | acceptStarted () noexcept |
virtual void | acceptStopped () noexcept |
Private Attributes | |
folly::EventBase * | evb_ |
int | numLoops_ |
size_t | bufferSize_ |
bool | zeroCopy_ |
std::unique_ptr< ZeroCopyTestAsyncSocket > | client_ |
std::unordered_map< ZeroCopyTestAsyncSocket *, std::shared_ptr< ZeroCopyTestAsyncSocket > > | clients_ |
Definition at line 213 of file ZeroCopy.h.
|
inlineexplicit |
Definition at line 215 of file ZeroCopy.h.
|
inlineoverridevirtualnoexcept |
acceptError() is called if an error occurs while accepting.
The AcceptCallback will remain installed even after an accept error, as the errors are typically somewhat transient, such as being out of file descriptors. The server socket must be explicitly stopped if you wish to stop accepting after an error.
ex | An exception representing the error. |
Implements folly::AsyncServerSocket::AcceptCallback.
Definition at line 237 of file ZeroCopy.h.
|
inline |
Definition at line 225 of file ZeroCopy.h.
References folly::AsyncServerSocket::addAcceptCallback(), and folly::ZeroCopyTestAsyncSocket::evb_.
Referenced by folly::ZeroCopyTest::ZeroCopyTest().
|
inlineoverridevirtualnoexcept |
connectionAccepted() is called whenever a new client connection is received.
The AcceptCallback will remain installed after connectionAccepted() returns.
fd | The newly accepted client socket. The AcceptCallback assumes ownership of this socket, and is responsible for closing it when done. The newly accepted file descriptor will have already been put into non-blocking mode. |
clientAddr | A reference to a SocketAddress struct containing the client's address. This struct is only guaranteed to remain valid until connectionAccepted() returns. |
Implements folly::AsyncServerSocket::AcceptCallback.
Definition at line 229 of file ZeroCopy.h.
References folly::ZeroCopyTestAsyncSocket::bufferSize_, folly::ZeroCopyTestAsyncSocket::evb_, folly::ZeroCopyTestAsyncSocket::numLoops_, and folly::ZeroCopyTestAsyncSocket::zeroCopy_.
|
private |
Definition at line 242 of file ZeroCopy.h.
|
private |
Definition at line 244 of file ZeroCopy.h.
|
private |
Definition at line 248 of file ZeroCopy.h.
|
private |
Definition at line 240 of file ZeroCopy.h.
|
private |
Definition at line 241 of file ZeroCopy.h.
|
private |
Definition at line 243 of file ZeroCopy.h.