fn handle_hci_device_event(
    message: WatchMessage,
    snoopers: &mut ConcurrentSnooperPacketFutures,
    subscribers: &mut SubscriptionManager,
    packet_logs: &mut PacketLogs,
) {
    let path = absolute_device_path(&message.filename);

    match message.event {
        WatchEvent::ADD_FILE | WatchEvent::EXISTING => {
            fx_log_info!("Opening snoop channel for hci device \"{}\"", path.display());
            match Snooper::new(path.clone()) {
                Ok(snooper) => {
                    snoopers.push(snooper.into_future());
                    let removed_device = packet_logs.add_device(path_to_string(&message.filename));
                    if let Some(device) = removed_device {
                        subscribers.remove_device(&device);
                    }
                }
                Err(e) => {
                    fx_log_warn!("Failed to open snoop channel for \"{}\": {}", path.display(), e);
                }
            }
        }
        WatchEvent::REMOVE_FILE => {
            fx_log_info!("Removing snoop channel for hci device: \"{}\"", path.display());
            // TODO(belgum): What should be done with the logged packets in this case?
            //               Find out how to remove snooper from ConcurrentTask (perhaps cancel
            //               and wake)
            //               Can possibly reopen device logs for devices that are on disk that
            //               were evicted from the packet logs collection in the past.
        }
        _ => (),
    }
}
/// Handle an event on the virtual filesystem in the HCI device directory. This should log or
/// internally handle most errors that come from the stream of filesystem watch events. Only errors
/// in the `Watcher` itself result in returning an Error to the caller.
Handle an event on the virtual filesystem in the HCI device directory. This should log or
internally handle most errors that come from the stream of filesystem watch events. Only errors
in the `Watcher` itself result in returning an Error to the caller.
Handle an event on the virtual filesystem in the HCI device directory . This should log or internally handle most errors that come from the stream of filesystem watch events . Only errors in the ` Watcher ` itself result in returning an Error to the caller .
fn handle_hci_device_event(
    message: WatchMessage,
    snoopers: &mut ConcurrentSnooperPacketFutures,
    subscribers: &mut SubscriptionManager,
    packet_logs: &mut PacketLogs,
) {
    let path = absolute_device_path(&message.filename);
    match message.event {
        WatchEvent::ADD_FILE | WatchEvent::EXISTING => {
            fx_log_info!("Opening snoop channel for hci device \"{}\"", path.display());
            match Snooper::new(path.clone()) {
                Ok(snooper) => {
                    snoopers.push(snooper.into_future());
                    let removed_device = packet_logs.add_device(path_to_string(&message.filename));
                    if let Some(device) = removed_device {
                        subscribers.remove_device(&device);
                    }
                }
                Err(e) => {
                    fx_log_warn!("Failed to open snoop channel for \"{}\": {}", path.display(), e);
                }
            }
        }
        WatchEvent::REMOVE_FILE => {
            fx_log_info!("Removing snoop channel for hci device: \"{}\"", path.display());
            // TODO(belgum): What should be done with the logged packets in this case?
            //               Find out how to remove snooper from ConcurrentTask (perhaps cancel
            //               and wake)
            //               Can possibly reopen device logs for devices that are on disk that
            //               were evicted from the packet logs collection in the past.
        }
        _ => (),
    }
}
fn handle_hci_device_event ( message : WatchMessage , snoopers : & mut ConcurrentSnooperPacketFutures , subscribers : & mut SubscriptionManager , packet_logs : & mut PacketLogs , ) { let path = absolute_device_path ( & message . filename ) ; match message . event { WatchEvent :: ADD_FILE | WatchEvent :: EXISTING => { fx_log_info ! ( " \" \" " path display ( ) ) ; match Snooper :: new ( path . clone ( ) ) { Ok ( snooper ) => { snoopers . push ( snooper . into_future ( ) ) ; let removed_device = packet_logs . add_device ( path_to_string ( & message . filename ) ) ; if let Some ( device ) = removed_device { subscribers . remove_device ( & device ) ; } } Err ( e ) => { fx_log_warn ! ( " \" \" " path display ( ) e ) ; } } } WatchEvent :: REMOVE_FILE => { fx_log_info ! ( " \" \" " path display ( ) ) ; // TODO(belgum): What should be done with the logged packets in this case? //               Find out how to remove snooper from ConcurrentTask (perhaps cancel //               and wake) //               Can possibly reopen device logs for devices that are on disk that //               were evicted from the packet logs collection in the past. } _ => ( ) , } }
Handle an event on the virtual filesystem in the HCI device directory.
Handle an event on the virtual filesystem in the HCI device directory .
message
WatchMessage
snoopers
&mut ConcurrentSnooperPacketFutures
subscribers
&mut SubscriptionManager
packet_logs
&mut PacketLogs
message
WatchMessage
snoopers
&mut ConcurrentSnooperPacketFutures
subscribers
&mut SubscriptionManager
packet_logs
&mut PacketLogs