refactor: remove ScopedTask (#2125)

* replace ScopedTask with AbortOnDropHandle
This commit is contained in:
Luna Yao
2026-04-25 09:20:25 +02:00
committed by GitHub
parent 820d9095d3
commit 5a1668c753
32 changed files with 161 additions and 300 deletions
+4 -3
View File
@@ -3,7 +3,7 @@ use std::sync::Arc;
use crate::{
common::{
config::TomlConfigLoader, global_ctx::GlobalCtx, log, os_info::collect_device_os_info,
scoped_task::ScopedTask, set_default_machine_id, stun::MockStunInfoCollector,
set_default_machine_id, stun::MockStunInfoCollector,
},
connector::create_connector_by_url,
instance_manager::{DaemonGuard, NetworkInstanceManager},
@@ -12,6 +12,7 @@ use crate::{
};
use anyhow::{Context as _, Result};
use async_trait::async_trait;
use tokio_util::task::AbortOnDropHandle;
use url::Url;
use uuid::Uuid;
@@ -43,7 +44,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
pub struct WebClient {
controller: Arc<controller::Controller>,
tasks: ScopedTask<()>,
tasks: AbortOnDropHandle<()>,
manager_guard: DaemonGuard,
connected: Arc<AtomicBool>,
}
@@ -70,7 +71,7 @@ impl WebClient {
let controller_clone = controller.clone();
let connected_clone = connected.clone();
let tasks = ScopedTask::from(tokio::spawn(async move {
let tasks = AbortOnDropHandle::new(tokio::spawn(async move {
Self::routine(
controller_clone,
connected_clone,