Format /net folder
Formatting done via: git ls-files | grep -E '^net\/.*\.(h|cc|mm)' | xargs clang-format -i No-Iwyu: Includes didn't change and it isn't related to formatting Bug: webrtc:42225392 Change-Id: I5c9daed6c83459ace469dd2820e1cc4565dad8f6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/373882 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#43683}
This commit is contained in:
parent
536c19a64d
commit
6b6ebf3689
@ -100,8 +100,7 @@ HeartbeatHandler::HeartbeatHandler(absl::string_view log_prefix,
|
||||
interval_timer_(timer_manager_->CreateTimer(
|
||||
"heartbeat-interval",
|
||||
absl::bind_front(&HeartbeatHandler::OnIntervalTimerExpiry, this),
|
||||
TimerOptions(interval_duration_,
|
||||
TimerBackoffAlgorithm::kFixed))),
|
||||
TimerOptions(interval_duration_, TimerBackoffAlgorithm::kFixed))),
|
||||
timeout_timer_(timer_manager_->CreateTimer(
|
||||
"heartbeat-timeout",
|
||||
absl::bind_front(&HeartbeatHandler::OnTimeoutTimerExpiry, this),
|
||||
@ -121,8 +120,7 @@ void HeartbeatHandler::RestartTimer() {
|
||||
if (interval_duration_should_include_rtt_) {
|
||||
// The RTT should be used, but it's not easy accessible. The RTO will
|
||||
// suffice.
|
||||
interval_timer_->set_duration(
|
||||
interval_duration_ + ctx_->current_rto());
|
||||
interval_timer_->set_duration(interval_duration_ + ctx_->current_rto());
|
||||
} else {
|
||||
interval_timer_->set_duration(interval_duration_);
|
||||
}
|
||||
|
||||
@ -60,34 +60,37 @@ void TaskQueueTimeoutFactory::TaskQueueTimeout::Start(DurationMs duration_ms,
|
||||
posted_task_expiration_ = timeout_expiration_;
|
||||
parent_.task_queue_.PostDelayedTaskWithPrecision(
|
||||
precision_,
|
||||
webrtc::SafeTask(
|
||||
pending_task_safety_flag_,
|
||||
[timeout_id, this]() {
|
||||
RTC_DLOG(LS_VERBOSE) << "Timout expired: " << timeout_id.value();
|
||||
RTC_DCHECK_RUN_ON(&parent_.thread_checker_);
|
||||
RTC_DCHECK(!posted_task_expiration_.IsPlusInfinity());
|
||||
posted_task_expiration_ = Timestamp::PlusInfinity();
|
||||
webrtc::SafeTask(pending_task_safety_flag_,
|
||||
[timeout_id, this]() {
|
||||
RTC_DLOG(LS_VERBOSE)
|
||||
<< "Timout expired: " << timeout_id.value();
|
||||
RTC_DCHECK_RUN_ON(&parent_.thread_checker_);
|
||||
RTC_DCHECK(!posted_task_expiration_.IsPlusInfinity());
|
||||
posted_task_expiration_ = Timestamp::PlusInfinity();
|
||||
|
||||
if (timeout_expiration_.IsPlusInfinity()) {
|
||||
// The timeout was stopped before it expired. Very common.
|
||||
} else {
|
||||
// Note that the timeout might have been restarted, which updated
|
||||
// `timeout_expiration_` but left the scheduled task running. So
|
||||
// if it's not quite time to trigger the timeout yet, schedule a
|
||||
// new delayed task with what's remaining and retry at that point
|
||||
// in time.
|
||||
TimeDelta remaining = timeout_expiration_ - parent_.Now();
|
||||
timeout_expiration_ = Timestamp::PlusInfinity();
|
||||
if (remaining > TimeDelta::Zero()) {
|
||||
Start(DurationMs(remaining.ms()), timeout_id_);
|
||||
} else {
|
||||
// It has actually triggered.
|
||||
RTC_DLOG(LS_VERBOSE)
|
||||
<< "Timout triggered: " << timeout_id.value();
|
||||
parent_.on_expired_(timeout_id_);
|
||||
}
|
||||
}
|
||||
}),
|
||||
if (timeout_expiration_.IsPlusInfinity()) {
|
||||
// The timeout was stopped before it expired. Very
|
||||
// common.
|
||||
} else {
|
||||
// Note that the timeout might have been restarted,
|
||||
// which updated `timeout_expiration_` but left the
|
||||
// scheduled task running. So if it's not quite time
|
||||
// to trigger the timeout yet, schedule a new delayed
|
||||
// task with what's remaining and retry at that point
|
||||
// in time.
|
||||
TimeDelta remaining =
|
||||
timeout_expiration_ - parent_.Now();
|
||||
timeout_expiration_ = Timestamp::PlusInfinity();
|
||||
if (remaining > TimeDelta::Zero()) {
|
||||
Start(DurationMs(remaining.ms()), timeout_id_);
|
||||
} else {
|
||||
// It has actually triggered.
|
||||
RTC_DLOG(LS_VERBOSE)
|
||||
<< "Timout triggered: " << timeout_id.value();
|
||||
parent_.on_expired_(timeout_id_);
|
||||
}
|
||||
}
|
||||
}),
|
||||
webrtc::TimeDelta::Millis(duration_ms.value()));
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user