proxygen
|
#include <HHWheelTimer.h>
Public Member Functions | |
Callback ()=default | |
virtual | ~Callback () |
virtual void | timeoutExpired () noexcept=0 |
virtual void | callbackCanceled () noexcept |
void | cancelTimeout () |
bool | isScheduled () const |
std::chrono::milliseconds | getTimeRemaining () |
Protected Member Functions | |
virtual std::chrono::steady_clock::time_point | getCurTime () |
Private Types | |
typedef boost::intrusive::list< Callback, boost::intrusive::constant_time_size< false > > | List |
Private Member Functions | |
std::chrono::milliseconds | getTimeRemaining (std::chrono::steady_clock::time_point now) const |
void | setScheduled (HHWheelTimer *wheel, std::chrono::milliseconds) |
void | cancelTimeoutImpl () |
Private Attributes | |
HHWheelTimer * | wheel_ {nullptr} |
std::chrono::steady_clock::time_point | expiration_ {} |
int | bucket_ {-1} |
std::shared_ptr< RequestContext > | requestContext_ |
Friends | |
class | HHWheelTimer |
A callback to be notified when a timeout has expired.
Definition at line 68 of file HHWheelTimer.h.
|
private |
Definition at line 145 of file HHWheelTimer.h.
|
default |
|
virtual |
|
inlinevirtualnoexcept |
This callback was canceled. The default implementation is to just proxy to timeoutExpired
but if you care about the difference between the timeout finishing or being canceled you can override this.
Reimplemented in proxygen::HTTPTransaction::RateLimitCallback.
Definition at line 83 of file HHWheelTimer.h.
References timeoutExpired().
|
inline |
Cancel the timeout, if it is running.
If the timeout is not scheduled, cancelTimeout() does nothing.
Definition at line 92 of file HHWheelTimer.h.
References cancelTimeoutImpl(), and wheel_.
Referenced by proxygen::HTTP2PriorityQueue::Node::addChild(), proxygen::HTTP2PriorityQueue::Node::convertVirtualNode(), wangle::ConnectionManager::dropAllConnections(), proxygen::HTTPTransaction::markIngressComplete(), proxygen::HTTPSession::onConnectionSendWindowOpen(), proxygen::HTTPSession::onWriteSuccess(), proxygen::HTTPTransaction::pauseIngress(), proxygen::HTTPSession::pauseReadsImpl(), wangle::ConnectionManager::removeConnection(), folly::HHWheelTimer::scheduleTimeout(), proxygen::HTTPSession::shutdownTransportWithReset(), proxygen::HTTPTransaction::updateReadTimeout(), ~Callback(), proxygen::HTTPSession::~HTTPSession(), and proxygen::HTTPTransaction::~HTTPTransaction().
|
private |
Definition at line 63 of file HHWheelTimer.cpp.
References folly::HHWheelTimer::bitmap_, bucket_, folly::HHWheelTimer::buckets_, folly::HHWheelTimer::count_, expiration_, folly::makeBitIterator(), and wheel_.
Referenced by cancelTimeout(), and getTimeRemaining().
|
inlineprotectedvirtual |
Don't override this unless you're doing a test. This is mainly here so that we can override it to simulate lag in steady_clock.
Definition at line 121 of file HHWheelTimer.h.
References now().
Referenced by getTimeRemaining(), and setScheduled().
|
inline |
Get the time remaining until this timeout expires. Return 0 if this timeout is not scheduled or expired. Otherwise, return expiration time minus getCurTime().
Definition at line 112 of file HHWheelTimer.h.
References getCurTime().
|
inlineprivate |
Definition at line 127 of file HHWheelTimer.h.
References cancelTimeoutImpl(), expiration_, now(), and setScheduled().
|
inline |
Return true if this timeout is currently scheduled, and false otherwise.
Definition at line 103 of file HHWheelTimer.h.
References wheel_.
Referenced by proxygen::HTTPSession::detach(), proxygen::HTTPUpstreamSession::isReusable(), proxygen::HTTPSession::onConnectionSendWindowClosed(), proxygen::HTTPSession::onWriteSuccess(), proxygen::HTTPSession::runLoopCallback(), proxygen::HTTPSession::shutdownTransport(), ~Callback(), proxygen::HTTPSession::~HTTPSession(), and proxygen::HTTPTransaction::~HTTPTransaction().
|
private |
Definition at line 52 of file HHWheelTimer.cpp.
References expiration_, getCurTime(), and wheel_.
Referenced by getTimeRemaining(), and folly::HHWheelTimer::scheduleTimeout().
|
pure virtualnoexcept |
timeoutExpired() is invoked when the timeout has expired.
Implemented in proxygen::HTTPTransaction::RateLimitCallback, proxygen::HTTPTransaction, proxygen::HTTPSession::DrainTimeout, proxygen::HTTPSession::FlowControlTimeout, proxygen::HTTPSession::WriteTimeout, proxygen::HTTP2PriorityQueue::Node, proxygen::HTTPSession, wangle::AcceptorHandshakeManager, wangle::ServerAcceptor< Pipeline >::ServerConnection, wangle::ManagedConnection, and TestConnection.
Referenced by callbackCanceled(), folly::HHWheelTimer::isDetachable(), and folly::HHWheelTimer::scheduleTimeoutFn().
|
friend |
Definition at line 151 of file HHWheelTimer.h.
Referenced by folly::HHWheelTimer::isDetachable().
|
private |
Definition at line 141 of file HHWheelTimer.h.
Referenced by cancelTimeoutImpl(), and folly::HHWheelTimer::scheduleTimeoutImpl().
|
private |
Definition at line 140 of file HHWheelTimer.h.
Referenced by cancelTimeoutImpl(), getTimeRemaining(), and setScheduled().
|
private |
Definition at line 147 of file HHWheelTimer.h.
Referenced by folly::HHWheelTimer::scheduleTimeout().
|
private |
Definition at line 139 of file HHWheelTimer.h.
Referenced by cancelTimeout(), cancelTimeoutImpl(), isScheduled(), and setScheduled().