// sock is dispatched with a recv_loop, as well as broadcasting an
// mdns query to discover Fuchsia devices every interval.
sock is dispatched with a recv_loop, as well as broadcasting an
mdns query to discover Fuchsia devices every interval.
sock is dispatched with a recv_loop as well as broadcasting an mdns query to discover Fuchsia devices every interval .
async fn query_recv_loop(
    sock: Arc<UdpSocket>,
    e: events::Queue<DaemonEvent>,
    interval: Duration,
    tasks: Arc<Mutex<HashMap<IpAddr, Task<()>>>>,
) {
    let mut recv = recv_loop(sock.clone(), e).boxed_local().fuse();
    let mut query = query_loop(sock.clone(), interval).boxed_local().fuse();
    let addr = match sock.local_addr() {
        Ok(addr) => addr,
        Err(err) => {
            log::error!("mdns: failed to shutdown: {:?}", err);
            return;
        }
    };
    log::info!("mdns: started query socket {}", &addr);
    let _ = futures::select!(
        _ = recv => {},
        _ = query => {},
    );
    drop(recv);
    drop(query);
    tasks.lock().await.remove(&addr.ip()).map(drop);
    log::info!("mdns: shut down query socket {}", &addr);
}
async fn query_recv_loop ( sock : Arc < UdpSocket > , e : events :: Queue < DaemonEvent > , interval : Duration , tasks : Arc < Mutex < HashMap < IpAddr , Task < ( ) > > > > , ) { let mut recv = recv_loop ( sock . clone ( ) , e ) . boxed_local ( ) . fuse ( ) ; let mut query = query_loop ( sock . clone ( ) , interval ) . boxed_local ( ) . fuse ( ) ; let addr = match sock . local_addr ( ) { Ok ( addr ) => addr , Err ( err ) => { log :: error ! ( " " err ) ; return ; } } ; log :: info ! ( " " addr ) ; let _ = futures :: select ! ( recv { } query { } ) ; drop ( recv ) ; drop ( query ) ; tasks . lock ( ) . await . remove ( & addr . ip ( ) ) . map ( drop ) ; log :: info ! ( " " addr ) ; }
sock is dispatched with a recv_loop, as well as broadcasting an
mdns query to discover Fuchsia devices every interval.
sock is dispatched with a recv_loop as well as broadcasting an mdns query to discover Fuchsia devices every interval .
sock
Arc<UdpSocket>
e
events::Queue<DaemonEvent>
interval
Duration
tasks
Arc<Mutex<HashMap<IpAddr, Task<()>>>>