fn scan_network(&mut self, event_loop: &mut EventLoop<Self>) {
        let mut app_context = self.app_context.lock()
            .unwrap();

        // check if the discovery is enabled and if there is another scanner
        // running
        if app_context.discovery && self.scanner.is_none() {
            self.last_scan = time::precise_time_s();

            app_context.scanning = true;

            let logger           = self.logger.clone();
            let rtsp_paths_file  = self.rtsp_paths_file.clone();
            let mjpeg_paths_file = self.mjpeg_paths_file.clone();
            let app_context      = self.app_context.clone();
            let sender           = event_loop.channel();

            let handle = thread::spawn(move || {
                network_scanner_thread(logger,
                    &rtsp_paths_file,
                    &mjpeg_paths_file,
                    app_context);

                sender.send(CommandWrapper::ScanCompleted)
                    .unwrap();
            });

            self.scanner = Some(handle);
        }
    }
/// Spawn a new network scanner thread (if it is not already running) and
/// save its join handle.
Spawn a new network scanner thread (if it is not already running) and
save its join handle.
Spawn a new network scanner thread ( if it is not already running ) and save its join handle .
fn scan_network(&mut self, event_loop: &mut EventLoop<Self>) {
        let mut app_context = self.app_context.lock()
            .unwrap();
        // check if the discovery is enabled and if there is another scanner
        // running
        if app_context.discovery && self.scanner.is_none() {
            self.last_scan = time::precise_time_s();
            app_context.scanning = true;
            let logger           = self.logger.clone();
            let rtsp_paths_file  = self.rtsp_paths_file.clone();
            let mjpeg_paths_file = self.mjpeg_paths_file.clone();
            let app_context      = self.app_context.clone();
            let sender           = event_loop.channel();
            let handle = thread::spawn(move || {
                network_scanner_thread(logger,
                    &rtsp_paths_file,
                    &mjpeg_paths_file,
                    app_context);
                sender.send(CommandWrapper::ScanCompleted)
                    .unwrap();
            });
            self.scanner = Some(handle);
        }
    }
fn scan_network ( & mut self , event_loop : & mut EventLoop < Self > ) { let mut app_context = self . app_context . lock ( ) . unwrap ( ) ; // check if the discovery is enabled and if there is another scanner // running if app_context . discovery && self . scanner . is_none ( ) { self . last_scan = time :: precise_time_s ( ) ; app_context . scanning = true ; let logger = self . logger . clone ( ) ; let rtsp_paths_file = self . rtsp_paths_file . clone ( ) ; let mjpeg_paths_file = self . mjpeg_paths_file . clone ( ) ; let app_context = self . app_context . clone ( ) ; let sender = event_loop . channel ( ) ; let handle = thread :: spawn ( move | | { network_scanner_thread ( logger , & rtsp_paths_file , & mjpeg_paths_file , app_context ) ; sender . send ( CommandWrapper :: ScanCompleted ) . unwrap ( ) ; } ) ; self . scanner = Some ( handle ) ; } }
Spawn a new network scanner thread (if it is not already running) and
save its join handle.
Spawn a new network scanner thread ( if it is not already running ) and save its join handle .
&mut self
event_loop
&mut EventLoop<Self>
&mut self
event_loop
&mut EventLoop<Self>