Commit 9b5424cc authored by nanamicat's avatar nanamicat

clean

parent fa6de2cc
......@@ -41,6 +41,7 @@ async fn main() -> anyhow::Result<()> {
);
let socket = UdpSocket::bind(config.bind).await?;
tracing::info!("Listening on {}", config.bind);
let mut timer = time::interval(INTERVAL);
let mut buf = [0; 1500];
......@@ -56,7 +57,6 @@ async fn main() -> anyhow::Result<()> {
result = socket.recv_from(&mut buf) => {
let (len, addr) = result?;
tracing::info!("{:?} {:?}", addr, server_addr);
if addr.port() == config.bind.port()
&& let Some(peer) = Router::get(&mut routers, addr)
&& let Ok((hello, _)) = bincode::decode_from_slice(&buf[..len], bincode::config::standard())
......
......@@ -64,16 +64,7 @@ impl Router {
}
}
let now_ms = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_millis() as u32;
tracing::info!(
"[{:?}] on_message: remote_time (packet)={} local_time (now)={} raw_diff (now-remote)={} delta={}",
self.link_address,
data.time,
now_ms,
now_ms.wrapping_sub(data.time) as i32,
delta
);
let delay = now_ms.wrapping_sub(data.time) as i32;
let delay = (SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_millis() as u32).wrapping_sub(data.time) as i32;
self.delay = delay; //+= (delay - self.delay) / 4;
......
......@@ -38,7 +38,6 @@ impl Server {
config: &Settings, // routers: &mut HashMap<u8, Router>,
// self_peer: &Hello,
) -> Option<Uplink> {
tracing::info!("server message {:?}, version = {}", message, message.version);
if message.ack != self.version {
return None;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment