Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-re-ka committed Feb 7, 2024
1 parent 70146dd commit 12a1d1d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
5 changes: 2 additions & 3 deletions src/bmp_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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));
}
Expand Down
24 changes: 14 additions & 10 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -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]
Expand Down Expand Up @@ -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())?;
Expand Down

0 comments on commit 12a1d1d

Please sign in to comment.