From b2eac5bfe01a485cf8bfe5b091823104904c2a89 Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Sat, 17 Sep 2022 23:01:36 +0200 Subject: [PATCH] optimized initialization --- src/firewall/mod.rs | 2 +- src/ipblc/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/firewall/mod.rs b/src/firewall/mod.rs index e026bf7..947e0a3 100644 --- a/src/firewall/mod.rs +++ b/src/firewall/mod.rs @@ -60,7 +60,7 @@ pub fn block( // validate and send batch let finalized_batch = batch.finalize(); send_and_process(&finalized_batch)?; - if fwlen < &mut ips_add.len() { + if fwlen != &mut ips_add.len() { ret.push(format!("{length} ip in firewall", length = ips_add.len())); } *fwlen = ips_add.len(); diff --git a/src/ipblc/mod.rs b/src/ipblc/mod.rs index 2745c3b..ba2ecab 100644 --- a/src/ipblc/mod.rs +++ b/src/ipblc/mod.rs @@ -89,7 +89,7 @@ async fn listenpubsub(ctx: &Arc>, txpubsub: Sender, socke Some(ss) => { let msg = ss.strip_prefix(prefix.as_str()).unwrap(); let tosend: IpData = serde_json::from_str(msg).unwrap(); - if tosend.hostname != gethostname(true) { + if tosend.hostname != gethostname(true) || tosend.mode == "zmq".to_string() { txpubsub.send(tosend).await.unwrap(); } }