Format Rust code using rustfmt

This commit is contained in:
github-actions[bot] 2024-10-03 01:56:31 +00:00 committed by GitHub
parent e3a19f41f1
commit 059efbb52a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 17 deletions

View File

@ -6,12 +6,7 @@ use types::{
ActivePassthroughs, IdentityExt, NetData, OnchainPKI, Peers, PendingPassthroughs, TCP_PROTOCOL,
WS_PROTOCOL,
};
use {
dashmap::DashMap,
ring::signature::Ed25519KeyPair,
std::sync::Arc,
tokio::task::JoinSet,
};
use {dashmap::DashMap, ring::signature::Ed25519KeyPair, std::sync::Arc, tokio::task::JoinSet};
mod connect;
mod indirect;

View File

@ -52,23 +52,22 @@ pub async fn create_passthrough(
if data.active_passthroughs.len() + data.pending_passthroughs.len()
>= data.max_passthroughs as usize
{
let oldest_active = data
.active_passthroughs
.iter()
.min_by_key(|p| p.0);
let (oldest_active_key, oldest_active_time, oldest_active_kill_sender) = match oldest_active {
let oldest_active = data.active_passthroughs.iter().min_by_key(|p| p.0);
let (oldest_active_key, oldest_active_time, oldest_active_kill_sender) = match oldest_active
{
None => (None, get_now(), None),
Some(oldest_active) => {
let (oldest_active_key, oldest_active_val) = oldest_active.pair();
let oldest_active_key = oldest_active_key.clone();
let (oldest_active_time, oldest_active_kill_sender) = oldest_active_val.clone();
(Some(oldest_active_key), oldest_active_time, Some(oldest_active_kill_sender))
(
Some(oldest_active_key),
oldest_active_time,
Some(oldest_active_kill_sender),
)
}
};
let oldest_pending = data
.pending_passthroughs
.iter()
.min_by_key(|p| p.1);
let oldest_pending = data.pending_passthroughs.iter().min_by_key(|p| p.1);
let (oldest_pending_key, oldest_pending_time) = match oldest_pending {
None => (None, get_now()),
Some(oldest_pending) => {
@ -84,7 +83,8 @@ pub async fn create_passthrough(
data.active_passthroughs.remove(&oldest_active_key.unwrap());
} else {
// pending key is oldest
data.pending_passthroughs.remove(&oldest_pending_key.unwrap());
data.pending_passthroughs
.remove(&oldest_pending_key.unwrap());
}
}
// if the target has already generated a pending passthrough for this source,