diff --git a/ubw-sward/src/http/counter.rs b/ubw-sward/src/http/counter.rs index 05e387c..901578e 100644 --- a/ubw-sward/src/http/counter.rs +++ b/ubw-sward/src/http/counter.rs @@ -10,8 +10,10 @@ pub struct AtomicHttpCounter { #[derive(Default)] pub struct HttpCounter { + pub sent: usize, pub http_2xx: usize, pub http_3xx: usize, pub http_4xx: usize, pub http_5xx: usize, + pub error: usize, } \ No newline at end of file diff --git a/ubw-sward/src/http/integrated.rs b/ubw-sward/src/http/integrated.rs index 1b28bde..cb72530 100644 --- a/ubw-sward/src/http/integrated.rs +++ b/ubw-sward/src/http/integrated.rs @@ -27,6 +27,7 @@ pub struct IntegratedHttpSward { impl IntegratedHttpSward { pub async fn oneshot(&mut self) -> Result { + self.result_counter.sent += 1; let url = match &mut self.attack_target { AttackTarget::Random(random) => random.generate_url()?, AttackTarget::Fixed(url) => url.clone(), @@ -71,7 +72,9 @@ impl IntegratedHttpSward { return Ok(()); } oneshop_result = self.oneshot() => { - oneshop_result?; + if oneshop_result.is_err() { + self.result_counter.error += 1; + } } } }