introduce websocket tunnel

This commit is contained in:
sijie.sun
2024-05-11 22:46:23 +08:00
committed by Sijie.Sun
parent a5637003ad
commit 1b1d76de99
12 changed files with 647 additions and 110 deletions
+4 -2
View File
@@ -1,9 +1,9 @@
// this mod wrap tunnel to a mpsc tunnel, based on crossbeam_channel
use std::pin::Pin;
use std::{pin::Pin, time::Duration};
use anyhow::Context;
use tokio::task::JoinHandle;
use tokio::{task::JoinHandle, time::timeout};
use super::{packet_def::ZCPacket, Tunnel, TunnelError, ZCPacketSink, ZCPacketStream};
@@ -42,6 +42,8 @@ impl<T: Tunnel> MpscTunnel<T> {
break;
}
}
let close_ret = timeout(Duration::from_secs(5), sink.close()).await;
tracing::warn!(?close_ret, "mpsc close sink");
});
Self {