mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Consolidate backend scanner status, paging, and query-param duplication
Add ActiveStatusCell/PassiveStatusCell wrappers in the scanners common module so the five per-scanner status.rs files reduce to a single static; replace parse_parameter_bool/int/string with one generic parse_parameter over FromStr; extract the shared LIMIT/OFFSET paging clause into db::apply_paging; and drop a no-op for-loop in the ARP sender. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
c022e672d1
commit
8749ff33c1
@@ -1,26 +1,3 @@
|
||||
use once_cell::sync::OnceCell;
|
||||
use std::sync::Mutex;
|
||||
use crate::scanners::common::passive_status::PassiveStatusCell;
|
||||
|
||||
use crate::scanners::common::passive_status::{PassiveSnapshot, PassiveStatus};
|
||||
|
||||
static STATUS: OnceCell<Mutex<PassiveStatus>> = OnceCell::new();
|
||||
|
||||
pub fn init() {
|
||||
STATUS.set(Mutex::new(PassiveStatus::new())).ok();
|
||||
}
|
||||
|
||||
pub fn set_listening() {
|
||||
if let Some(m) = STATUS.get() {
|
||||
m.lock().unwrap().set_listening();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn record_discovery(mac: &str) {
|
||||
if let Some(m) = STATUS.get() {
|
||||
m.lock().unwrap().record_discovery(mac);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get() -> Option<PassiveSnapshot> {
|
||||
STATUS.get().map(|m| m.lock().unwrap().snapshot())
|
||||
}
|
||||
pub static STATUS: PassiveStatusCell = PassiveStatusCell::new();
|
||||
|
||||
Reference in New Issue
Block a user