From 18a2eae1ddc3b46e2ec7cd75c8b1685cbdd94876 Mon Sep 17 00:00:00 2001 From: Vladimir Lebedev Date: Mon, 6 May 2024 17:42:56 +0700 Subject: [PATCH] Add debug logs --- liteapi/src/server.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/liteapi/src/server.rs b/liteapi/src/server.rs index eaa1aa9..47b41ec 100644 --- a/liteapi/src/server.rs +++ b/liteapi/src/server.rs @@ -6,7 +6,6 @@ use std::time::Duration; use adnl::AdnlPeer; use adnl::AdnlPrivateKey; -use log::error; use tokio::net::TcpListener; use tokio::net::ToSocketAddrs; use tokio_tower::multiplex::Server; @@ -40,19 +39,21 @@ pub async fn serve(addr: &A, private_key: S, mut service_maker: M) -> R // > will be logged at the `error` level, since it is still a big deal, // > and then the listener will sleep for 1 second. if !matches!(e.kind(), ErrorKind::ConnectionRefused | ErrorKind::ConnectionAborted | ErrorKind::ConnectionReset) { - error!("accept error: {e}"); + log::error!("accept error: {e}"); tokio::time::sleep(Duration::from_secs(1)).await; } continue; } }; + log::debug!("[{addr:?}] Accepted socket"); poll_fn(|cx| service_maker.poll_ready(cx)).await.expect("polling service maker failed"); let service = service_maker.make_service(addr).await.expect("making service failed"); let private_key = private_key.clone(); tokio::spawn(async move { let adnl = AdnlPeer::handle_handshake(socket, |_| Some(private_key.clone())).await.expect("handshake failed"); + log::debug!("[{addr:?}] Handshake performed"); let lite = LitePeer::new(adnl); Server::new(lite, service).await.expect("server failed"); }); } -} \ No newline at end of file +}