Fixed worker UI

This commit is contained in:
2026-06-29 07:08:25 -03:00
parent 60df71843a
commit e886d643a8
+3 -31
View File
@@ -1,8 +1,4 @@
use crate::{
config::Config,
scan::check_port_open,
terminal::{ScreenState, TerminalUi},
};
use crate::{config::Config, scan::check_port_open, terminal::TerminalUi};
use anyhow::{anyhow, Context, Result};
use std::{net::Ipv4Addr, sync::Arc};
use tokio::{
@@ -38,14 +34,8 @@ pub async fn run_worker(config: Config, ui: Arc<TerminalUi>) -> Result<()> {
}
let job = parse_job_line(&line)?;
let result = execute_job(
&job.ips,
config.port,
config.timeout_ms,
config.concurrency,
&ui,
)
.await?;
let result =
execute_job(&job.ips, config.port, config.timeout_ms, config.concurrency).await?;
let result_line = format!(
"RESULT {} {} {} {} {}\n",
@@ -58,15 +48,6 @@ pub async fn run_worker(config: Config, ui: Arc<TerminalUi>) -> Result<()> {
write_half.write_all(result_line.as_bytes()).await?;
}
if ui.is_enabled() {
ui.render(&ScreenState {
current_ip: "concluído".to_string(),
tested: 0,
total: 0,
});
ui.finish();
}
Ok(())
}
@@ -138,7 +119,6 @@ async fn execute_job(
port: u16,
timeout_ms: u64,
concurrency: usize,
ui: &TerminalUi,
) -> Result<JobOutcome> {
let mut tested = 0usize;
let mut open_ips = Vec::new();
@@ -159,14 +139,6 @@ async fn execute_job(
if is_open {
open_ips.push(ip);
}
if ui.is_enabled() {
ui.render(&ScreenState {
current_ip: ip.to_string(),
tested,
total: ips.len(),
});
}
}
index = end;