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:
Boris Tsirkin 2025-01-08 05:33:32 -08:00 committed by WebRTC LUCI CQ
parent 536c19a64d
commit 6b6ebf3689
2 changed files with 32 additions and 31 deletions

View File

@ -100,8 +100,7 @@ HeartbeatHandler::HeartbeatHandler(absl::string_view log_prefix,
interval_timer_(timer_manager_->CreateTimer( interval_timer_(timer_manager_->CreateTimer(
"heartbeat-interval", "heartbeat-interval",
absl::bind_front(&HeartbeatHandler::OnIntervalTimerExpiry, this), absl::bind_front(&HeartbeatHandler::OnIntervalTimerExpiry, this),
TimerOptions(interval_duration_, TimerOptions(interval_duration_, TimerBackoffAlgorithm::kFixed))),
TimerBackoffAlgorithm::kFixed))),
timeout_timer_(timer_manager_->CreateTimer( timeout_timer_(timer_manager_->CreateTimer(
"heartbeat-timeout", "heartbeat-timeout",
absl::bind_front(&HeartbeatHandler::OnTimeoutTimerExpiry, this), absl::bind_front(&HeartbeatHandler::OnTimeoutTimerExpiry, this),
@ -121,8 +120,7 @@ void HeartbeatHandler::RestartTimer() {
if (interval_duration_should_include_rtt_) { if (interval_duration_should_include_rtt_) {
// The RTT should be used, but it's not easy accessible. The RTO will // The RTT should be used, but it's not easy accessible. The RTO will
// suffice. // suffice.
interval_timer_->set_duration( interval_timer_->set_duration(interval_duration_ + ctx_->current_rto());
interval_duration_ + ctx_->current_rto());
} else { } else {
interval_timer_->set_duration(interval_duration_); interval_timer_->set_duration(interval_duration_);
} }

View File

@ -60,34 +60,37 @@ void TaskQueueTimeoutFactory::TaskQueueTimeout::Start(DurationMs duration_ms,
posted_task_expiration_ = timeout_expiration_; posted_task_expiration_ = timeout_expiration_;
parent_.task_queue_.PostDelayedTaskWithPrecision( parent_.task_queue_.PostDelayedTaskWithPrecision(
precision_, precision_,
webrtc::SafeTask( webrtc::SafeTask(pending_task_safety_flag_,
pending_task_safety_flag_, [timeout_id, this]() {
[timeout_id, this]() { RTC_DLOG(LS_VERBOSE)
RTC_DLOG(LS_VERBOSE) << "Timout expired: " << timeout_id.value(); << "Timout expired: " << timeout_id.value();
RTC_DCHECK_RUN_ON(&parent_.thread_checker_); RTC_DCHECK_RUN_ON(&parent_.thread_checker_);
RTC_DCHECK(!posted_task_expiration_.IsPlusInfinity()); RTC_DCHECK(!posted_task_expiration_.IsPlusInfinity());
posted_task_expiration_ = Timestamp::PlusInfinity(); posted_task_expiration_ = Timestamp::PlusInfinity();
if (timeout_expiration_.IsPlusInfinity()) { if (timeout_expiration_.IsPlusInfinity()) {
// The timeout was stopped before it expired. Very common. // The timeout was stopped before it expired. Very
} else { // common.
// Note that the timeout might have been restarted, which updated } else {
// `timeout_expiration_` but left the scheduled task running. So // Note that the timeout might have been restarted,
// if it's not quite time to trigger the timeout yet, schedule a // which updated `timeout_expiration_` but left the
// new delayed task with what's remaining and retry at that point // scheduled task running. So if it's not quite time
// in time. // to trigger the timeout yet, schedule a new delayed
TimeDelta remaining = timeout_expiration_ - parent_.Now(); // task with what's remaining and retry at that point
timeout_expiration_ = Timestamp::PlusInfinity(); // in time.
if (remaining > TimeDelta::Zero()) { TimeDelta remaining =
Start(DurationMs(remaining.ms()), timeout_id_); timeout_expiration_ - parent_.Now();
} else { timeout_expiration_ = Timestamp::PlusInfinity();
// It has actually triggered. if (remaining > TimeDelta::Zero()) {
RTC_DLOG(LS_VERBOSE) Start(DurationMs(remaining.ms()), timeout_id_);
<< "Timout triggered: " << timeout_id.value(); } else {
parent_.on_expired_(timeout_id_); // It has actually triggered.
} RTC_DLOG(LS_VERBOSE)
} << "Timout triggered: " << timeout_id.value();
}), parent_.on_expired_(timeout_id_);
}
}
}),
webrtc::TimeDelta::Millis(duration_ms.value())); webrtc::TimeDelta::Millis(duration_ms.value()));
} }