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
@@ -5,11 +5,12 @@ use std::{pin::Pin, time::Duration};
use anyhow::Context;
use tokio::time::timeout;
use crate::{common::scoped_task::ScopedTask, proto::common::TunnelInfo};
use crate::proto::common::TunnelInfo;
use super::{Tunnel, TunnelError, ZCPacketSink, ZCPacketStream, packet_def::ZCPacket};
use tokio::sync::mpsc::{Receiver, Sender, channel, error::TrySendError};
use tokio_util::task::AbortOnDropHandle;
// use tachyonix::{channel, Receiver, Sender, TrySendError};
use futures::SinkExt;
@@ -37,7 +38,7 @@ pub struct MpscTunnel<T> {
tunnel: T,
stream: Option<Pin<Box<dyn ZCPacketStream>>>,
task: ScopedTask<()>,
task: AbortOnDropHandle<()>,
}
impl<T: Tunnel> MpscTunnel<T> {
@@ -61,7 +62,7 @@ impl<T: Tunnel> MpscTunnel<T> {
tx: Some(tx),
tunnel,
stream: Some(stream),
task: task.into(),
task: AbortOnDropHandle::new(task),
}
}