mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-08-08 09:42:06 +03:00
Move QuicEventBase and QuicTimer callback operations back to the Callbacks themselves.
Summary: This moves all the loop and timer callback operations back to the callbacks instead of relying the QuicEventBase to perform them. I.e. it's now Callback::cancelCallback() instead of QuicEventBase::cancelCallback(&callback). To simplify the design, the lifetime of LoopCallbackWrapper and TimerCallbackWrapper has been changed. Previously these wrappers lasted for one iteration of the loop or the timer callback. In the new design the wrapper is created the first time the callback is scheduled and is only destroyed when the callback is destroyed. This significantly simplifies the lifetime management of the wrapper and the code overall. While transitioning LibevQuicEventBase to this new design, this change also consolidates the QuicTimer functionality in the LibevQuicEventBase itself. Reviewed By: hanidamlaj, mjoras Differential Revision: D52217879 fbshipit-source-id: da7b95d592650ddc112813fdc3b9f5010d32e7fb
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2008fa9163
commit
96b65104dc
@@ -262,7 +262,7 @@ class TestQuicTransport
|
||||
}
|
||||
|
||||
std::chrono::milliseconds getLossTimeoutRemainingTime() {
|
||||
return evb_->getTimeoutTimeRemaining(&lossTimeout_);
|
||||
return lossTimeout_.getTimerCallbackTimeRemaining();
|
||||
}
|
||||
|
||||
void onReadData(const folly::SocketAddress&, ReceivedUdpPacket&& udpPacket)
|
||||
@@ -365,7 +365,7 @@ class TestQuicTransport
|
||||
}
|
||||
|
||||
void invokeCancelPingTimeout() {
|
||||
evb_->cancelTimeout(&pingTimeout_);
|
||||
pingTimeout_.cancelTimerCallback();
|
||||
}
|
||||
|
||||
void invokeHandlePingCallbacks() {
|
||||
@@ -377,10 +377,7 @@ class TestQuicTransport
|
||||
}
|
||||
|
||||
bool isPingTimeoutScheduled() {
|
||||
if (evb_->isTimeoutScheduled(&pingTimeout_)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return pingTimeout_.isTimerCallbackScheduled();
|
||||
}
|
||||
|
||||
auto& writeLooper() {
|
||||
|
Reference in New Issue
Block a user