From 12a1d1d48cf80d17a9c8010a1c868976ba9b636a Mon Sep 17 00:00:00 2001 From: Yureka Date: Wed, 7 Feb 2024 15:02:06 +0100 Subject: [PATCH] format --- src/bmp_collector.rs | 5 ++--- src/main.rs | 24 ++++++++++++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/bmp_collector.rs b/src/bmp_collector.rs index b200a9d..7ac1fa8 100644 --- a/src/bmp_collector.rs +++ b/src/bmp_collector.rs @@ -11,8 +11,7 @@ use tokio::net::{TcpListener, TcpStream}; use tokio::sync::mpsc; use tokio_util::codec::length_delimited::LengthDelimitedCodec; use zettabgp::bmp::prelude::{ - BmpMessagePeerDown, BmpMessagePeerHeader, BmpMessageRouteMonitoring, - BmpMessageTermination, + BmpMessagePeerDown, BmpMessagePeerHeader, BmpMessageRouteMonitoring, BmpMessageTermination, }; use zettabgp::bmp::BmpMessage; @@ -172,7 +171,7 @@ pub async fn run_client( run_peer(client_addr, rm.peer.clone(), store) }); channel.send(Ok(rm)).await.unwrap(); - }, + } BmpMessage::PeerUpNotification(n) => { channels.insert(n.peer.peeraddress, run_peer(client_addr, n.peer, store)); } diff --git a/src/main.rs b/src/main.rs index 03ad41c..59315a6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,9 +1,9 @@ use fernglas::*; +use figment::providers::{Env, Format, Yaml}; +use figment::Figment; use futures_util::future::{join_all, select_all}; use log::*; use tokio::signal::unix::{signal, SignalKind}; -use figment::Figment; -use figment::providers::{Yaml, Env, Format}; #[cfg(feature = "mimalloc")] #[global_allocator] @@ -42,14 +42,18 @@ async fn main() -> anyhow::Result<()> { shutdown_rx.clone(), ))); - futures.extend(cfg.collectors.into_iter().map(|(_, collector)| match collector { - CollectorConfig::Bmp(cfg) => { - tokio::task::spawn(bmp_collector::run(cfg, store.clone(), shutdown_rx.clone())) - } - CollectorConfig::Bgp(cfg) => { - tokio::task::spawn(bgp_collector::run(cfg, store.clone(), shutdown_rx.clone())) - } - })); + futures.extend( + cfg.collectors + .into_iter() + .map(|(_, collector)| match collector { + CollectorConfig::Bmp(cfg) => { + tokio::task::spawn(bmp_collector::run(cfg, store.clone(), shutdown_rx.clone())) + } + CollectorConfig::Bgp(cfg) => { + tokio::task::spawn(bgp_collector::run(cfg, store.clone(), shutdown_rx.clone())) + } + }), + ); let mut sigint = signal(SignalKind::interrupt())?; let mut sigterm = signal(SignalKind::terminate())?;