From 76e952830302271e07a4be9df6dfaa1c11e3e675 Mon Sep 17 00:00:00 2001 From: hozan23 Date: Wed, 13 Mar 2024 03:35:09 +0100 Subject: net: pass `Endpoint` to dial and listen functions --- p2p/src/discovery/refresh.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'p2p/src/discovery') diff --git a/p2p/src/discovery/refresh.rs b/p2p/src/discovery/refresh.rs index ed111fb..882a93e 100644 --- a/p2p/src/discovery/refresh.rs +++ b/p2p/src/discovery/refresh.rs @@ -195,7 +195,8 @@ impl RefreshService { /// specified in the Config, with backoff between each retry. async fn connect(&self, entry: &Entry) -> Result<()> { let mut retry = 0; - let conn = dial_udp(&entry.addr, &entry.discovery_port).await?; + let endpoint = Endpoint::Ws(entry.addr.clone(), entry.discovery_port); + let conn = dial_udp(&endpoint).await?; let backoff = Backoff::new(100, 5000); while retry < self.config.refresh_connect_retries { match self.send_ping_msg(&conn).await { @@ -217,7 +218,7 @@ impl RefreshService { /// peers. async fn listen_loop(self: Arc, addr: Addr, port: Port) -> Result<()> { let endpoint = Endpoint::Udp(addr.clone(), port); - let conn = match listen_udp(&addr, &port).await { + let conn = match listen_udp(&endpoint).await { Ok(c) => { self.monitor .notify(&ConnEvent::Listening(endpoint.clone()).into()) -- cgit v1.2.3