aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/rendezvous_server.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/rendezvous_server.rs')
-rw-r--r--src/rendezvous_server.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/rendezvous_server.rs b/src/rendezvous_server.rs
index da69540..7a63c11 100644
--- a/src/rendezvous_server.rs
+++ b/src/rendezvous_server.rs
@@ -766,15 +766,11 @@ impl RendezvousServer {
) -> ResultType<()> {
let mut states = BytesMut::zeroed((peers.len() + 7) / 8);
for i in 0..peers.len() {
- let peer_id = &peers[i];
- // bytes index from left to right
- let states_idx = i / 8;
- let bit_idx = 7 - i % 8;
- if let Some(peer) = self.pm.get_in_memory(&peer_id).await {
- let (elapsed, _) = {
- let r = peer.read().await;
- (r.last_reg_time.elapsed().as_millis() as i32, r.socket_addr)
- };
+ if let Some(peer) = self.pm.get_in_memory(&peers[i]).await {
+ let elapsed = peer.read().await.last_reg_time.elapsed().as_millis() as i32;
+ // bytes index from left to right
+ let states_idx = i / 8;
+ let bit_idx = 7 - i % 8;
if elapsed < REG_TIMEOUT {
states[states_idx] |= 0x01 << bit_idx;
}
@@ -1213,7 +1209,7 @@ async fn check_relay_servers(rs0: Arc<RelayServers>, tx: Sender) {
let rs = rs.clone();
let x = x.clone();
futs.push(tokio::spawn(async move {
- if FramedStream::new(&host, "0.0.0.0:0", CHECK_RELAY_TIMEOUT)
+ if FramedStream::new(&host, None, CHECK_RELAY_TIMEOUT)
.await
.is_ok()
{