Skip to content

Commit

Permalink
Remove commented code + make expectations clear
Browse files Browse the repository at this point in the history
  • Loading branch information
tanuva committed Nov 27, 2023
1 parent 5b9237d commit e059471
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions escl-scan/src/scannerfinder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub struct ScannerFinder {

impl ScannerFinder {
pub fn new() -> ScannerFinder {
//ScannerFinder { scanners: vec![] }
ScannerFinder {
scanners: Arc::new(Mutex::new(vec![])),
}
Expand All @@ -50,8 +49,6 @@ impl ScannerFinder {

let mut browser = MdnsBrowser::new(service_type);
browser.set_service_discovered_callback(Box::new(Self::on_service_discovered));

//let scanners: Arc<Mutex<Vec<Scanner>>> = Arc::new(Mutex::new(vec![]));
browser.set_context(Box::new(Arc::clone(&self.scanners)));

let event_loop = match browser.browse_services() {
Expand Down Expand Up @@ -98,12 +95,11 @@ impl ScannerFinder {
};

log::info!("Service discovered: {service:?}",);
//let mut context = context.expect("We provided a scanner list as context");
let scanners = context
.as_ref()
.unwrap()
.expect("Context was passed to on_service_discovered")
.downcast_ref::<Arc<Mutex<Vec<Scanner>>>>()
.unwrap();
.expect("context can be downcasted to Arc<Mutex<Vec<Scanner>>>");
let mut scanners = scanners.lock().unwrap();

let txt: &TxtRecord = match service.txt() {
Expand Down

0 comments on commit e059471

Please sign in to comment.