optimized initialization

This commit is contained in:
Paul 2022-09-17 23:01:36 +02:00
parent da6ef34b0e
commit b2eac5bfe0
2 changed files with 2 additions and 2 deletions

View File

@ -60,7 +60,7 @@ pub fn block(
// validate and send batch // validate and send batch
let finalized_batch = batch.finalize(); let finalized_batch = batch.finalize();
send_and_process(&finalized_batch)?; 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())); ret.push(format!("{length} ip in firewall", length = ips_add.len()));
} }
*fwlen = ips_add.len(); *fwlen = ips_add.len();

View File

@ -89,7 +89,7 @@ async fn listenpubsub(ctx: &Arc<Mutex<Context>>, txpubsub: Sender<IpData>, socke
Some(ss) => { Some(ss) => {
let msg = ss.strip_prefix(prefix.as_str()).unwrap(); let msg = ss.strip_prefix(prefix.as_str()).unwrap();
let tosend: IpData = serde_json::from_str(msg).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(); txpubsub.send(tosend).await.unwrap();
} }
} }