proxygen
folly::test::TestConnectionEventCallback Class Reference

#include <AsyncSocketTest2.h>

Inheritance diagram for folly::test::TestConnectionEventCallback:
folly::AsyncServerSocket::ConnectionEventCallback

Public Member Functions

void onConnectionAccepted (const int, const SocketAddress &) noexceptoverride
 
void onConnectionAcceptError (const int) noexceptoverride
 
void onConnectionDropped (const int, const SocketAddress &) noexceptoverride
 
void onConnectionEnqueuedForAcceptorCallback (const int, const SocketAddress &) noexceptoverride
 
void onConnectionDequeuedByAcceptorCallback (const int, const SocketAddress &) noexceptoverride
 
void onBackoffStarted () noexceptoverride
 
void onBackoffEnded () noexceptoverride
 
void onBackoffError () noexceptoverride
 
unsigned int getConnectionAccepted () const
 
unsigned int getConnectionAcceptedError () const
 
unsigned int getConnectionDropped () const
 
unsigned int getConnectionEnqueuedForAcceptCallback () const
 
unsigned int getConnectionDequeuedByAcceptCallback () const
 
unsigned int getBackoffStarted () const
 
unsigned int getBackoffEnded () const
 
unsigned int getBackoffError () const
 
- Public Member Functions inherited from folly::AsyncServerSocket::ConnectionEventCallback
virtual ~ConnectionEventCallback ()=default
 

Private Attributes

folly::RWSpinLock spinLock_
 
unsigned int connectionAccepted_ {0}
 
unsigned int connectionAcceptedError_ {0}
 
unsigned int connectionDropped_ {0}
 
unsigned int connectionEnqueuedForAcceptCallback_ {0}
 
unsigned int connectionDequeuedByAcceptCallback_ {0}
 
unsigned int backoffStarted_ {0}
 
unsigned int backoffEnded_ {0}
 
unsigned int backoffError_ {0}
 

Detailed Description

Helper ConnectionEventCallback class for the test code. It maintains counters protected by a spin lock.

Definition at line 34 of file AsyncSocketTest2.h.

Member Function Documentation

unsigned int folly::test::TestConnectionEventCallback::getBackoffEnded ( ) const
inline

Definition at line 115 of file AsyncSocketTest2.h.

References backoffEnded_, and spinLock_.

Referenced by TEST().

unsigned int folly::test::TestConnectionEventCallback::getBackoffError ( ) const
inline

Definition at line 120 of file AsyncSocketTest2.h.

References backoffError_, and spinLock_.

Referenced by TEST().

unsigned int folly::test::TestConnectionEventCallback::getBackoffStarted ( ) const
inline

Definition at line 110 of file AsyncSocketTest2.h.

References backoffStarted_, and spinLock_.

Referenced by TEST().

unsigned int folly::test::TestConnectionEventCallback::getConnectionAccepted ( ) const
inline
unsigned int folly::test::TestConnectionEventCallback::getConnectionAcceptedError ( ) const
inline
unsigned int folly::test::TestConnectionEventCallback::getConnectionDequeuedByAcceptCallback ( ) const
inline
unsigned int folly::test::TestConnectionEventCallback::getConnectionDropped ( ) const
inline

Definition at line 95 of file AsyncSocketTest2.h.

References connectionDropped_, and spinLock_.

Referenced by TEST().

unsigned int folly::test::TestConnectionEventCallback::getConnectionEnqueuedForAcceptCallback ( ) const
inline
void folly::test::TestConnectionEventCallback::onBackoffEnded ( )
inlineoverridevirtualnoexcept

onBackoffEnded is called when the backoff period has ended and the socket has successfully resumed accepting new connections if there is any AcceptCallback registered.

Implements folly::AsyncServerSocket::ConnectionEventCallback.

Definition at line 75 of file AsyncSocketTest2.h.

References backoffEnded_, and spinLock_.

void folly::test::TestConnectionEventCallback::onBackoffError ( )
inlineoverridevirtualnoexcept

onBackoffError is called when there is an error entering backoff

Implements folly::AsyncServerSocket::ConnectionEventCallback.

Definition at line 80 of file AsyncSocketTest2.h.

References backoffError_, and spinLock_.

void folly::test::TestConnectionEventCallback::onBackoffStarted ( )
inlineoverridevirtualnoexcept

onBackoffStarted is called when the socket has successfully started backing off accepting new client sockets.

Implements folly::AsyncServerSocket::ConnectionEventCallback.

Definition at line 70 of file AsyncSocketTest2.h.

References backoffStarted_, and spinLock_.

void folly::test::TestConnectionEventCallback::onConnectionAccepted ( const int  socket,
const SocketAddress addr 
)
inlineoverridevirtualnoexcept

onConnectionAccepted() is called right after a client connection is accepted using the system accept()/accept4() APIs.

Implements folly::AsyncServerSocket::ConnectionEventCallback.

Definition at line 37 of file AsyncSocketTest2.h.

References connectionAccepted_, and spinLock_.

void folly::test::TestConnectionEventCallback::onConnectionAcceptError ( const int  err)
inlineoverridevirtualnoexcept
void folly::test::TestConnectionEventCallback::onConnectionDequeuedByAcceptorCallback ( const int  socket,
const SocketAddress addr 
)
inlineoverridevirtualnoexcept
void folly::test::TestConnectionEventCallback::onConnectionDropped ( const int  socket,
const SocketAddress addr 
)
inlineoverridevirtualnoexcept

onConnectionDropped() is called when a connection is dropped, probably because of some error encountered.

Implements folly::AsyncServerSocket::ConnectionEventCallback.

Definition at line 49 of file AsyncSocketTest2.h.

References connectionDropped_, and spinLock_.

void folly::test::TestConnectionEventCallback::onConnectionEnqueuedForAcceptorCallback ( const int  socket,
const SocketAddress addr 
)
inlineoverridevirtualnoexcept

onConnectionEnqueuedForAcceptorCallback() is called when the connection is successfully enqueued for an AcceptCallback to pick up.

Implements folly::AsyncServerSocket::ConnectionEventCallback.

Definition at line 56 of file AsyncSocketTest2.h.

References connectionEnqueuedForAcceptCallback_, and spinLock_.

Member Data Documentation

unsigned int folly::test::TestConnectionEventCallback::backoffEnded_ {0}
private

Definition at line 133 of file AsyncSocketTest2.h.

Referenced by getBackoffEnded(), and onBackoffEnded().

unsigned int folly::test::TestConnectionEventCallback::backoffError_ {0}
private

Definition at line 134 of file AsyncSocketTest2.h.

Referenced by getBackoffError(), and onBackoffError().

unsigned int folly::test::TestConnectionEventCallback::backoffStarted_ {0}
private

Definition at line 132 of file AsyncSocketTest2.h.

Referenced by getBackoffStarted(), and onBackoffStarted().

unsigned int folly::test::TestConnectionEventCallback::connectionAccepted_ {0}
private

Definition at line 127 of file AsyncSocketTest2.h.

Referenced by getConnectionAccepted(), and onConnectionAccepted().

unsigned int folly::test::TestConnectionEventCallback::connectionAcceptedError_ {0}
private

Definition at line 128 of file AsyncSocketTest2.h.

Referenced by getConnectionAcceptedError(), and onConnectionAcceptError().

unsigned int folly::test::TestConnectionEventCallback::connectionDequeuedByAcceptCallback_ {0}
private
unsigned int folly::test::TestConnectionEventCallback::connectionDropped_ {0}
private

Definition at line 129 of file AsyncSocketTest2.h.

Referenced by getConnectionDropped(), and onConnectionDropped().

unsigned int folly::test::TestConnectionEventCallback::connectionEnqueuedForAcceptCallback_ {0}
private

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