144 enum EventType { TYPE_START, TYPE_ACCEPT, TYPE_ERROR, TYPE_STOP };
147 :
type(TYPE_ACCEPT), fd(fd_), address(addr), errorMsg() {}
149 :
type(TYPE_ERROR), fd(-1), address(), errorMsg(msg) {}
151 :
type(et), fd(-1), address(), errorMsg() {}
161 : connectionAcceptedFn_(),
172 connectionAcceptedFn_ = fn;
178 acceptStartedFn_ = fn;
181 acceptStoppedFn_ = fn;
187 events_.emplace_back(fd, clientAddr);
189 if (connectionAcceptedFn_) {
190 connectionAcceptedFn_(fd, clientAddr);
194 events_.emplace_back(ex.what());
196 if (acceptErrorFn_) {
201 events_.emplace_back(TYPE_START);
203 if (acceptStartedFn_) {
208 events_.emplace_back(TYPE_STOP);
210 if (acceptStoppedFn_) {
void onBackoffEnded() noexceptoverride
unsigned int connectionDequeuedByAcceptCallback_
void onBackoffStarted() noexceptoverride
void setConnectionAcceptedFn(const std::function< void(int, const folly::SocketAddress &)> &fn)
EventInfo(const std::string &msg)
unsigned int connectionAcceptedError_
unsigned int getBackoffEnded() const
unsigned int backoffStarted_
void onConnectionDropped(const int, const SocketAddress &) noexceptoverride
std::deque< EventInfo > * getEvents()
unsigned int getBackoffError() const
void onBackoffError() noexceptoverride
unsigned int backoffError_
unsigned int getConnectionAcceptedError() const
—— Concurrent Priority Queue Implementation ——
unsigned int connectionDropped_
requires E e noexcept(noexcept(s.error(std::move(e))))
void onConnectionEnqueuedForAcceptorCallback(const int, const SocketAddress &) noexceptoverride
folly::SocketAddress address
void acceptStarted() noexceptoverride
unsigned int getConnectionDropped() const
std::function< void(const std::exception &)> acceptErrorFn_
void setAcceptStartedFn(const std::function< void()> &fn)
void onConnectionAccepted(const int, const SocketAddress &) noexceptoverride
std::function< void()> acceptStoppedFn_
void connectionAccepted(int fd, const folly::SocketAddress &clientAddr) noexceptoverride
unsigned int getBackoffStarted() const
std::function< void(int, const folly::SocketAddress &)> connectionAcceptedFn_
unsigned int connectionAccepted_
std::deque< EventInfo > EventList
void onConnectionDequeuedByAcceptorCallback(const int, const SocketAddress &) noexceptoverride
std::deque< EventInfo > events_
folly::RWSpinLock spinLock_
unsigned int getConnectionEnqueuedForAcceptCallback() const
void acceptError(const std::exception &ex) noexceptoverride
std::function< void()> acceptStartedFn_
unsigned int connectionEnqueuedForAcceptCallback_
EventInfo(int fd_, const folly::SocketAddress &addr)
void setAcceptErrorFn(const std::function< void(const std::exception &)> &fn)
ThreadPoolListHook * addr
unsigned int backoffEnded_
void acceptStopped() noexceptoverride
unsigned int getConnectionAccepted() const
void setAcceptStoppedFn(const std::function< void()> &fn)
unsigned int getConnectionDequeuedByAcceptCallback() const
void onConnectionAcceptError(const int) noexceptoverride