Sfoglia il codice sorgente

fix: log retry intervals

Yujia Qiao 4 anni fa
parent
commit
91b38cbe5f
2 ha cambiato i file con 6 aggiunte e 6 eliminazioni
  1. 2 2
      src/client.rs
  2. 4 4
      src/server.rs

+ 2 - 2
src/client.rs

@@ -176,8 +176,8 @@ async fn do_data_channel_handshake<T: Transport>(
                 .await
                 .with_context(|| "Failed to connect to remote_addr")?)
         },
-        |e, _| {
-            warn!("{:?}", e);
+        |e, duration| {
+            warn!("{:?}. Retry in {:?}", e, duration);
         },
     )
     .await?;

+ 4 - 4
src/server.rs

@@ -507,8 +507,8 @@ fn tcp_listen_and_send(
         // FIXME: Respect shutdown signal
         let l = backoff::future::retry_notify(listen_backoff(), || async {
             Ok(TcpListener::bind(&addr).await?)
-        }, |e, _| {
-            error!("{:?}", e);
+        }, |e, duration| {
+            error!("{:?}. Retry in {:?}", e, duration);
         })
         .await
         .with_context(|| "Failed to listen for the service");
@@ -618,8 +618,8 @@ async fn run_udp_connection_pool<T: Transport>(
                 .await
                 .with_context(|| "Failed to listen for the service")?)
         },
-        |e, _| {
-            warn!("{:?}", e);
+        |e, duration| {
+            warn!("{:?}. Retry in {:?}", e, duration);
         },
     )
     .await