mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-16 02:45:41 +00:00
refactor: remove ScopedTask (#2125)
* replace ScopedTask with AbortOnDropHandle
This commit is contained in:
@@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user