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)?;