From 996a80e710184426c2fd4fe96b02dde901ec02fd Mon Sep 17 00:00:00 2001 From: lubeilin <1791778603@qq.com> Date: Sun, 10 Mar 2024 14:09:47 +0800 Subject: [PATCH] =?UTF-8?q?[mio]=20=E8=B0=83=E6=95=B4=E6=89=93=E6=B4=9E?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnt/src/core/conn.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vnt/src/core/conn.rs b/vnt/src/core/conn.rs index 1370a02..c492b4a 100644 --- a/vnt/src/core/conn.rs +++ b/vnt/src/core/conn.rs @@ -1,7 +1,6 @@ use std::collections::HashMap; use std::io; use std::net::Ipv4Addr; -use std::sync::mpsc::{sync_channel, Receiver}; use std::sync::Arc; use std::time::Duration; @@ -20,6 +19,7 @@ use crate::cipher::Cipher; use crate::cipher::RsaCipher; use crate::core::Config; use crate::external_route::{AllowExternalRoute, ExternalRoute}; +use crate::handle::maintain::PunchReceiver; use crate::handle::recv_data::RecvDataHandler; use crate::handle::{ maintain, tun_tap, BaseConfigInfo, ConnectStatus, CurrentDeviceInfo, PeerDeviceInfo, @@ -45,6 +45,7 @@ pub struct Vnt { impl Vnt { pub fn new(config: Config, callback: Call) -> io::Result { + log::info!("config:{:?}", config); //服务端非对称加密 #[cfg(feature = "server_encrypt")] let rsa_cipher: Arc>> = Arc::new(Mutex::new(None)); @@ -136,7 +137,7 @@ impl Vnt { } else { None }; - let (punch_sender, punch_receiver) = sync_channel(3); + let (punch_sender, punch_receiver) = maintain::punch_channel(); let peer_nat_info_map: Arc>> = Arc::new(RwLock::new(HashMap::with_capacity(16))); let down_counter = @@ -250,7 +251,7 @@ pub fn start( current_device: Arc>, client_cipher: Cipher, server_cipher: Cipher, - punch_receiver: Receiver<(Ipv4Addr, NatInfo)>, + punch_receiver: PunchReceiver, config_info: BaseConfigInfo, punch: Punch, callback: Call,