fn send_control_response(
    command: impl IncomingTargetCommand,
    result: Result<Box<dyn PacketEncodable>, StatusCode>,
    pdu_id: PduId,
) -> Result<(), Error> {
    match result {
        Ok(encodable) => match encodable.encode_packet() {
            Ok(packet) => command
                .send_response(AvcResponseType::Accepted, &packet[..])
                .map_err(|e| Error::AvctpError(e)),
            Err(e) => {
                fx_log_err!("Error trying to encode response packet. Sending internal_error rejection to peer {:?}", e);
                send_avc_reject(command, u8::from(&pdu_id), StatusCode::InternalError)
            }
        },
        Err(status_code) => {
            fx_log_err!(
                "Error trying to encode response packet. Sending rejection to peer {:?}",
                status_code
            );
            send_avc_reject(command, u8::from(&pdu_id), status_code)
        }
    }
}
/// Sends control command response. Send's Accepted on response code on success.
Sends control command response. Send's Accepted on response code on success.
Sends control command response . Send ' s Accepted on response code on success .
fn send_control_response(
    command: impl IncomingTargetCommand,
    result: Result<Box<dyn PacketEncodable>, StatusCode>,
    pdu_id: PduId,
) -> Result<(), Error> {
    match result {
        Ok(encodable) => match encodable.encode_packet() {
            Ok(packet) => command
                .send_response(AvcResponseType::Accepted, &packet[..])
                .map_err(|e| Error::AvctpError(e)),
            Err(e) => {
                fx_log_err!("Error trying to encode response packet. Sending internal_error rejection to peer {:?}", e);
                send_avc_reject(command, u8::from(&pdu_id), StatusCode::InternalError)
            }
        },
        Err(status_code) => {
            fx_log_err!(
                "Error trying to encode response packet. Sending rejection to peer {:?}",
                status_code
            );
            send_avc_reject(command, u8::from(&pdu_id), status_code)
        }
    }
}
fn send_control_response ( command : impl IncomingTargetCommand , result : Result < Box < dyn PacketEncodable > , StatusCode > , pdu_id : PduId , ) -> Result < ( ) , Error > { match result { Ok ( encodable ) => match encodable . encode_packet ( ) { Ok ( packet ) => command . send_response ( AvcResponseType :: Accepted , & packet [ .. ] ) . map_err ( | e | Error :: AvctpError ( e ) ) , Err ( e ) => { fx_log_err ! ( " " e ) ; send_avc_reject ( command , u8 :: from ( & pdu_id ) , StatusCode :: InternalError ) } } , Err ( status_code ) => { fx_log_err ! ( " " status_code ) ; send_avc_reject ( command , u8 :: from ( & pdu_id ) , status_code ) } } }
Sends control command response.
Sends control command response .
command
impl IncomingTargetCommand
result
Result<Box<dyn PacketEncodable>, StatusCode>
pdu_id
PduId
command
impl IncomingTargetCommand
result
Result<Box<dyn PacketEncodable>, StatusCode>
pdu_id
PduId