From c783a96e13bce369e0884a53398c66b9ff1e84bf Mon Sep 17 00:00:00 2001 From: lubeilin <1791778603@qq.com> Date: Sun, 10 Mar 2024 14:07:04 +0800 Subject: [PATCH] =?UTF-8?q?[mio]=20=E6=89=93=E5=8D=B0=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnt/src/handle/maintain/idle.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vnt/src/handle/maintain/idle.rs b/vnt/src/handle/maintain/idle.rs index 4463414..347c91f 100644 --- a/vnt/src/handle/maintain/idle.rs +++ b/vnt/src/handle/maintain/idle.rs @@ -71,6 +71,10 @@ fn idle_gateway0( if let Err(e) = check_gateway_channel(context, cur, config, tcp_socket_sender, call, connect_count) { + call.error(ErrorInfo::new_msg( + ErrorType::Disconnect, + format!("connect:{},error:{:?}", cur.connect_server, e), + )); log::warn!("{:?}", e); } } @@ -83,7 +87,8 @@ fn idle_route0( let cur = current_device.load(); match idle.next_idle() { IdleType::Timeout(ip, route) => { - context.remove_route(&ip, route); + log::info!("route Timeout {:?},{:?}", ip, route); + context.remove_route(&ip, route.route_key()); if cur.is_gateway(&ip) { //网关路由过期,则需要改变状态 let cur = context.change_status(current_device); @@ -111,6 +116,9 @@ fn check_gateway_channel( .route_one(¤t_device.virtual_gateway); if gateway_route.is_none() { *count += 1; + if *count % 4 == 0 { + context.change_main_index(); + } //需要重连 call.connect(ConnectInfo::new(*count, current_device.connect_server)); let request_packet = handshaker::handshake_request_packet(config.client_secret)?;