fmt
This commit is contained in:
@@ -226,7 +226,7 @@ impl Punch {
|
||||
}
|
||||
pub fn punch(&mut self, buf: &[u8], id: Ipv4Addr, nat_info: NatInfo) -> io::Result<()> {
|
||||
if !self.context.route_table.need_punch(&id) {
|
||||
log::info!("已打洞成功,无需打洞:{:?}",id);
|
||||
log::info!("已打洞成功,无需打洞:{:?}", id);
|
||||
return Ok(());
|
||||
}
|
||||
if self.is_tcp && nat_info.tcp_port != 0 {
|
||||
|
||||
@@ -19,8 +19,8 @@ pub fn addr_request(
|
||||
config: BaseConfigInfo,
|
||||
) {
|
||||
addr_request0(&context, ¤t_device_info, &server_cipher, &config);
|
||||
// 9秒发送一次
|
||||
let rs = scheduler.timeout(Duration::from_secs(9), |s| {
|
||||
// 17秒发送一次
|
||||
let rs = scheduler.timeout(Duration::from_secs(17), |s| {
|
||||
addr_request(s, context, current_device_info, server_cipher, config)
|
||||
});
|
||||
if !rs {
|
||||
|
||||
@@ -12,7 +12,7 @@ use crate::cipher::Cipher;
|
||||
use crate::handle::{CurrentDeviceInfo, PeerDeviceInfo};
|
||||
use crate::protocol::body::ENCRYPTION_RESERVED;
|
||||
use crate::protocol::control_packet::PingPacket;
|
||||
use crate::protocol::{control_packet, NetPacket, Protocol, Version, MAX_TTL};
|
||||
use crate::protocol::{control_packet, NetPacket, Protocol, Version};
|
||||
use crate::util::Scheduler;
|
||||
|
||||
/// 定时发送心跳包
|
||||
@@ -216,7 +216,7 @@ fn heartbeat_packet(
|
||||
net_packet.set_version(Version::V1);
|
||||
net_packet.set_protocol(Protocol::Control);
|
||||
net_packet.set_transport_protocol(control_packet::Protocol::Ping.into());
|
||||
net_packet.first_set_ttl(MAX_TTL);
|
||||
net_packet.first_set_ttl(5);
|
||||
net_packet.set_source(src);
|
||||
net_packet.set_destination(dest);
|
||||
let mut ping = PingPacket::new(net_packet.payload_mut())?;
|
||||
|
||||
@@ -86,7 +86,6 @@ fn idle_gateway0<Call: VntCallback>(
|
||||
ErrorType::Disconnect,
|
||||
format!("connect:{},error:{:?}", cur.connect_server, e),
|
||||
));
|
||||
log::warn!("{:?}", e);
|
||||
}
|
||||
}
|
||||
fn idle_route0<Call: VntCallback>(
|
||||
|
||||
@@ -268,6 +268,7 @@ impl<Call: VntCallback> ServerPacketHandler<Call> {
|
||||
log::info!("ip发生变化,old:{:?},response={:?}", old, response);
|
||||
}
|
||||
if let Err(e) = self.device.set_ip(virtual_ip, virtual_netmask) {
|
||||
log::error!("LocalIpExists {:?}", e);
|
||||
self.callback.error(ErrorInfo::new_msg(
|
||||
ErrorType::LocalIpExists,
|
||||
format!("set_ip {:?}", e),
|
||||
@@ -421,12 +422,10 @@ impl<Call: VntCallback> ServerPacketHandler<Call> {
|
||||
self.callback.error(err);
|
||||
}
|
||||
InErrorPacket::IpAlreadyExists => {
|
||||
log::error!("IpAlreadyExists");
|
||||
let err = ErrorInfo::new(ErrorType::IpAlreadyExists);
|
||||
self.callback.error(err);
|
||||
}
|
||||
InErrorPacket::InvalidIp => {
|
||||
log::error!("InvalidIp");
|
||||
let err = ErrorInfo::new(ErrorType::InvalidIp);
|
||||
self.callback.error(err);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ pub fn base_handle(
|
||||
net_packet.set_version(Version::V1);
|
||||
net_packet.set_protocol(protocol::Protocol::IpTurn);
|
||||
net_packet.set_transport_protocol(ip_turn_packet::Protocol::Ipv4.into());
|
||||
net_packet.first_set_ttl(3);
|
||||
net_packet.first_set_ttl(6);
|
||||
net_packet.set_source(src_ip);
|
||||
net_packet.set_destination(dest_ip);
|
||||
if dest_ip == current_device.virtual_gateway {
|
||||
|
||||
Reference in New Issue
Block a user