pub async fn respond(mut self, mut response: OutgoingResponse) -> Result<()> {
        assert_ne!(response.msg.line.code.kind(), CodeKind::Provisional);

        self.registration
            .endpoint
            .send_outgoing_response(&mut response)
            .await?;

        if response.msg.line.code.kind() == CodeKind::Provisional {
            Ok(())
        } else {
            if response.parts.transport.reliable() {
                return Ok(());
            }

            let abandon = Instant::now() + T1 * 64;

            tokio::spawn(async move {
                while let Ok(msg) = timeout_at(abandon.into(), self.registration.receive()).await {
                    if msg.line.is_request() {
                        if let Err(e) = self
                            .registration
                            .endpoint
                            .send_outgoing_response(&mut response)
                            .await
                        {
                            log::warn!("Failed to retransmit message, {}", e);
                        }
                    }
                }
            });

            Ok(())
        }
    }
/// Respond with a final response (2XX-6XX)
///
/// # Panics
/// Panics if the given response is not a final response
Respond with a final response (2XX-6XX)
Respond with a final response ( 2XX - 6XX )
pub async fn respond(mut self, mut response: OutgoingResponse) -> Result<()> {
        assert_ne!(response.msg.line.code.kind(), CodeKind::Provisional);
        self.registration
            .endpoint
            .send_outgoing_response(&mut response)
            .await?;
        if response.msg.line.code.kind() == CodeKind::Provisional {
            Ok(())
        } else {
            if response.parts.transport.reliable() {
                return Ok(());
            }
            let abandon = Instant::now() + T1 * 64;
            tokio::spawn(async move {
                while let Ok(msg) = timeout_at(abandon.into(), self.registration.receive()).await {
                    if msg.line.is_request() {
                        if let Err(e) = self
                            .registration
                            .endpoint
                            .send_outgoing_response(&mut response)
                            .await
                        {
                            log::warn!("Failed to retransmit message, {}", e);
                        }
                    }
                }
            });
            Ok(())
        }
    }
pub async fn respond ( mut self , mut response : OutgoingResponse ) -> Result < ( ) > { assert_ne ! ( response msg line code kind ( ) CodeKind Provisional ) ; self . registration . endpoint . send_outgoing_response ( & mut response ) . await ? ; if response . msg . line . code . kind ( ) == CodeKind :: Provisional { Ok ( ( ) ) } else { if response . parts . transport . reliable ( ) { return Ok ( ( ) ) ; } let abandon = Instant :: now ( ) + T1 * 64 ; tokio :: spawn ( async move { while let Ok ( msg ) = timeout_at ( abandon . into ( ) , self . registration . receive ( ) ) . await { if msg . line . is_request ( ) { if let Err ( e ) = self . registration . endpoint . send_outgoing_response ( & mut response ) . await { log :: warn ! ( " " e ) ; } } } } ) ; Ok ( ( ) ) } }
Respond with a final response (2XX-6XX)
Respond with a final response ( 2XX - 6XX )
mut self
response
OutgoingResponse
panics
Panics if the given response is not a final response
Panics if the given response is not a final response