async fn initiate_after_timeout(
    peer_id: PeerId,
    peers: Arc<Mutex<ConnectedPeers>>,
    profile_svc: ProfileProxy,
    inspect: fuchsia_inspect::Node,
    timer_expired: fasync::Timer,
) {
    timer_expired.await;
    if peers.lock().is_connected(&peer_id) {
        fx_vlog!(
            tag: "a2dp-sink",
            1,
            "Peer {} has already connected. A2DP sink will not assume the INT role.",
            peer_id
        );
        return;
    }

    fx_vlog!(tag: "a2dp-sink", 1, "Remote peer has not established connection. A2DP sink will now assume the INT role.");
    let (status, channel) = profile_svc
        .connect_l2cap(&peer_id.to_string(), PSM_AVDTP as u16, ChannelParameters::new_empty())
        .await
        .expect("Signaling channel creation should work");

    if let Some(e) = status.error {
        fx_log_warn!("Couldn't connect to {}: {:?}", peer_id, e);
        return;
    }
    match channel.socket {
        Some(socket) => peers.lock().connected(inspect, peer_id, socket, true), // Start the streaming task.
        None => fx_log_warn!("Couldn't connect {}: no socket", peer_id),
    };
}
/// Establishes the signaling channel after the delay specified by `timer_expired`.
Establishes the signaling channel after the delay specified by `timer_expired`.
Establishes the signaling channel after the delay specified by ` timer_expired ` .
async fn initiate_after_timeout(
    peer_id: PeerId,
    peers: Arc<Mutex<ConnectedPeers>>,
    profile_svc: ProfileProxy,
    inspect: fuchsia_inspect::Node,
    timer_expired: fasync::Timer,
) {
    timer_expired.await;
    if peers.lock().is_connected(&peer_id) {
        fx_vlog!(
            tag: "a2dp-sink",
            1,
            "Peer {} has already connected. A2DP sink will not assume the INT role.",
            peer_id
        );
        return;
    }
    fx_vlog!(tag: "a2dp-sink", 1, "Remote peer has not established connection. A2DP sink will now assume the INT role.");
    let (status, channel) = profile_svc
        .connect_l2cap(&peer_id.to_string(), PSM_AVDTP as u16, ChannelParameters::new_empty())
        .await
        .expect("Signaling channel creation should work");
    if let Some(e) = status.error {
        fx_log_warn!("Couldn't connect to {}: {:?}", peer_id, e);
        return;
    }
    match channel.socket {
        Some(socket) => peers.lock().connected(inspect, peer_id, socket, true), // Start the streaming task.
        None => fx_log_warn!("Couldn't connect {}: no socket", peer_id),
    };
}
async fn initiate_after_timeout ( peer_id : PeerId , peers : Arc < Mutex < ConnectedPeers > > , profile_svc : ProfileProxy , inspect : fuchsia_inspect :: Node , timer_expired : fasync :: Timer , ) { timer_expired . await ; if peers . lock ( ) . is_connected ( & peer_id ) { fx_vlog ! ( tag " " 1 " " peer_id ) ; return ; } fx_vlog ! ( tag " " 1 " " ) ; let ( status , channel ) = profile_svc . connect_l2cap ( & peer_id . to_string ( ) , PSM_AVDTP as u16 , ChannelParameters :: new_empty ( ) ) . await . expect ( " " ) ; if let Some ( e ) = status . error { fx_log_warn ! ( " " peer_id e ) ; return ; } match channel . socket { Some ( socket ) => peers . lock ( ) . connected ( inspect , peer_id , socket , true ) , // Start the streaming task. None => fx_log_warn ! ( " " peer_id ) , } ; }
Establishes the signaling channel after the delay specified by `timer_expired`.
Establishes the signaling channel after the delay specified by ` timer_expired ` .
peer_id
PeerId
peers
Arc<Mutex<ConnectedPeers>>
profile_svc
ProfileProxy
inspect
fuchsia_inspect::Node
timer_expired
fasync::Timer
peer_id
PeerId
peers
Arc<Mutex<ConnectedPeers>>
profile_svc
ProfileProxy
inspect
fuchsia_inspect::Node
timer_expired
fasync::Timer