async fn connect_after_timeout(
    peer_id: PeerId,
    peers: Arc<Mutex<ConnectedPeers>>,
    controller_pool: Arc<Mutex<AvdtpControllerPool>>,
    profile_svc: ProfileProxy,
) {
    fx_vlog!(
        tag: "a2dp-sink",
        1,
        "A2DP sink - waiting {:?} before assuming INT role for peer {}.",
        INITIATOR_DELAY,
        peer_id,
    );
    fuchsia_async::Timer::new(INITIATOR_DELAY.after_now()).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 channel = match profile_svc
        .connect(&mut peer_id.into(), PSM_AVDTP, ChannelParameters::new_empty())
        .await
    {
        Err(e) => {
            fx_log_warn!("FIDL error creating channel: {:?}", e);
            return;
        }
        Ok(Err(e)) => {
            fx_log_warn!("Couldn't connect to {}: {:?}", peer_id, e);
            return;
        }
        Ok(Ok(channel)) => channel,
    };

    handle_connection(&peer_id, channel, true, &mut peers.lock(), &mut controller_pool.lock());
}
/// 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 connect_after_timeout(
    peer_id: PeerId,
    peers: Arc<Mutex<ConnectedPeers>>,
    controller_pool: Arc<Mutex<AvdtpControllerPool>>,
    profile_svc: ProfileProxy,
) {
    fx_vlog!(
        tag: "a2dp-sink",
        1,
        "A2DP sink - waiting {:?} before assuming INT role for peer {}.",
        INITIATOR_DELAY,
        peer_id,
    );
    fuchsia_async::Timer::new(INITIATOR_DELAY.after_now()).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 channel = match profile_svc
        .connect(&mut peer_id.into(), PSM_AVDTP, ChannelParameters::new_empty())
        .await
    {
        Err(e) => {
            fx_log_warn!("FIDL error creating channel: {:?}", e);
            return;
        }
        Ok(Err(e)) => {
            fx_log_warn!("Couldn't connect to {}: {:?}", peer_id, e);
            return;
        }
        Ok(Ok(channel)) => channel,
    };
    handle_connection(&peer_id, channel, true, &mut peers.lock(), &mut controller_pool.lock());
}
async fn connect_after_timeout ( peer_id : PeerId , peers : Arc < Mutex < ConnectedPeers > > , controller_pool : Arc < Mutex < AvdtpControllerPool > > , profile_svc : ProfileProxy , ) { fx_vlog ! ( tag " " 1 " " INITIATOR_DELAY peer_id ) ; fuchsia_async :: Timer :: new ( INITIATOR_DELAY . after_now ( ) ) . await ; if peers . lock ( ) . is_connected ( & peer_id ) { fx_vlog ! ( tag " " 1 " " peer_id ) ; return ; } fx_vlog ! ( tag " " 1 " " ) ; let channel = match profile_svc . connect ( & mut peer_id . into ( ) , PSM_AVDTP , ChannelParameters :: new_empty ( ) ) . await { Err ( e ) => { fx_log_warn ! ( " " e ) ; return ; } Ok ( Err ( e ) ) => { fx_log_warn ! ( " " peer_id e ) ; return ; } Ok ( Ok ( channel ) ) => channel , } ; handle_connection ( & peer_id , channel , true , & mut peers . lock ( ) , & mut controller_pool . lock ( ) ) ; }
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>>
controller_pool
Arc<Mutex<AvdtpControllerPool>>
profile_svc
ProfileProxy
peer_id
PeerId
peers
Arc<Mutex<ConnectedPeers>>
controller_pool
Arc<Mutex<AvdtpControllerPool>>
profile_svc
ProfileProxy