/// When a new handler is received, the state is not known. It might be stale because the
/// system is asynchronous and the PeerHandler connection has two sides. The handler will only
/// be stored if all the associated fidl calls are successful. Otherwise it is dropped without
/// being set.
When a new handler is received, the state is not known. It might be stale because the
system is asynchronous and the PeerHandler connection has two sides. The handler will only
be stored if all the associated fidl calls are successful. Otherwise it is dropped without
being set.
When a new handler is received the state is not known . It might be stale because the system is asynchronous and the PeerHandler connection has two sides . The handler will only be stored if all the associated fidl calls are successful . Otherwise it is dropped without being set .
async fn on_peer_handler(&mut self, handler: PeerHandlerProxy) -> Result<(), Error> {
        info!("Got request to handle peer {} headset using handler", self.id);
        // Getting the network information the first time should always return a complete table.
        // If the call returns an error, do not set up the handler.
        let info = match handler.watch_network_information().await {
            Ok(info) => info,
            Err(fidl::Error::ClientChannelClosed { status: zx::Status::PEER_CLOSED, .. }) => {
                return Ok(());
            }
            Err(e) => {
                warn!("Error handling peer request: {}", e);
                return Ok(());
            }
        };
        self.handle_network_update(info).await;
        let client_end = self.gain_control.get_client_end()?;
        if let Err(e) = handler.gain_control(client_end) {
            warn!("Error setting gain control for peer {}: {}", self.id, e);
            return Ok(());
        }
        self.calls = Calls::new(Some(handler.clone()));
        self.create_network_updates_stream(handler.clone());
        self.handler = Some(handler);
        Ok(())
    }
async fn on_peer_handler ( & mut self , handler : PeerHandlerProxy ) -> Result < ( ) , Error > { info ! ( " " self id ) ; // Getting the network information the first time should always return a complete table. // If the call returns an error, do not set up the handler. let info = match handler . watch_network_information ( ) . await { Ok ( info ) => info , Err ( fidl :: Error :: ClientChannelClosed { status : zx :: Status :: PEER_CLOSED , .. } ) => { return Ok ( ( ) ) ; } Err ( e ) => { warn ! ( " " e ) ; return Ok ( ( ) ) ; } } ; self . handle_network_update ( info ) . await ; let client_end = self . gain_control . get_client_end ( ) ? ; if let Err ( e ) = handler . gain_control ( client_end ) { warn ! ( " " self id e ) ; return Ok ( ( ) ) ; } self . calls = Calls :: new ( Some ( handler . clone ( ) ) ) ; self . create_network_updates_stream ( handler . clone ( ) ) ; self . handler = Some ( handler ) ; Ok ( ( ) ) }
When a new handler is received, the state is not known.
When a new handler is received the state is not known .
&mut self
handler
PeerHandlerProxy