pub async fn stop(&self) -> Result<()> {
        // Try closing everything and collect the errors
        let mut close_errs: Vec<Error> = vec![];
        {
            let srtp_session = {
                let mut srtp_session = self.srtp_session.lock().await;
                srtp_session.take()
            };
            if let Some(srtp_session) = srtp_session {
                match srtp_session.close().await {
                    Ok(_) => {}
                    Err(err) => {
                        close_errs.push(err.into());
                    }
                };
            }
        }

        {
            let srtcp_session = {
                let mut srtcp_session = self.srtcp_session.lock().await;
                srtcp_session.take()
            };
            if let Some(srtcp_session) = srtcp_session {
                match srtcp_session.close().await {
                    Ok(_) => {}
                    Err(err) => {
                        close_errs.push(err.into());
                    }
                };
            }
        }

        {
            let simulcast_streams: Vec<Arc<Stream>> = {
                let mut simulcast_streams = self.simulcast_streams.lock().await;
                simulcast_streams.drain().map(|(_, v)| v).collect()
            };
            for ss in simulcast_streams {
                match ss.close().await {
                    Ok(_) => {}
                    Err(err) => {
                        close_errs.push(Error::new(format!(
                            "simulcast_streams ssrc={}: {}",
                            ss.get_ssrc(),
                            err
                        )));
                    }
                };
            }
        }

        if let Some(conn) = self.conn().await {
            // dtls_transport connection may be closed on sctp close.
            match conn.close().await {
                Ok(_) => {}
                Err(err) => {
                    if err.to_string() != dtls::Error::ErrConnClosed.to_string() {
                        close_errs.push(err.into());
                    }
                }
            }
        }

        self.state_change(RTCDtlsTransportState::Closed).await;

        flatten_errs(close_errs)
    }
/// stops and closes the DTLSTransport object.
stops and closes the DTLSTransport object.
stops and closes the DTLSTransport object .
pub async fn stop(&self) -> Result<()> {
        // Try closing everything and collect the errors
        let mut close_errs: Vec<Error> = vec![];
        {
            let srtp_session = {
                let mut srtp_session = self.srtp_session.lock().await;
                srtp_session.take()
            };
            if let Some(srtp_session) = srtp_session {
                match srtp_session.close().await {
                    Ok(_) => {}
                    Err(err) => {
                        close_errs.push(err.into());
                    }
                };
            }
        }
        {
            let srtcp_session = {
                let mut srtcp_session = self.srtcp_session.lock().await;
                srtcp_session.take()
            };
            if let Some(srtcp_session) = srtcp_session {
                match srtcp_session.close().await {
                    Ok(_) => {}
                    Err(err) => {
                        close_errs.push(err.into());
                    }
                };
            }
        }
        {
            let simulcast_streams: Vec<Arc<Stream>> = {
                let mut simulcast_streams = self.simulcast_streams.lock().await;
                simulcast_streams.drain().map(|(_, v)| v).collect()
            };
            for ss in simulcast_streams {
                match ss.close().await {
                    Ok(_) => {}
                    Err(err) => {
                        close_errs.push(Error::new(format!(
                            "simulcast_streams ssrc={}: {}",
                            ss.get_ssrc(),
                            err
                        )));
                    }
                };
            }
        }
        if let Some(conn) = self.conn().await {
            // dtls_transport connection may be closed on sctp close.
            match conn.close().await {
                Ok(_) => {}
                Err(err) => {
                    if err.to_string() != dtls::Error::ErrConnClosed.to_string() {
                        close_errs.push(err.into());
                    }
                }
            }
        }
        self.state_change(RTCDtlsTransportState::Closed).await;
        flatten_errs(close_errs)
    }
pub async fn stop ( & self ) -> Result < ( ) > { // Try closing everything and collect the errors let mut close_errs : Vec < Error > = vec ! [ ] ; { let srtp_session = { let mut srtp_session = self . srtp_session . lock ( ) . await ; srtp_session . take ( ) } ; if let Some ( srtp_session ) = srtp_session { match srtp_session . close ( ) . await { Ok ( _ ) => { } Err ( err ) => { close_errs . push ( err . into ( ) ) ; } } ; } } { let srtcp_session = { let mut srtcp_session = self . srtcp_session . lock ( ) . await ; srtcp_session . take ( ) } ; if let Some ( srtcp_session ) = srtcp_session { match srtcp_session . close ( ) . await { Ok ( _ ) => { } Err ( err ) => { close_errs . push ( err . into ( ) ) ; } } ; } } { let simulcast_streams : Vec < Arc < Stream > > = { let mut simulcast_streams = self . simulcast_streams . lock ( ) . await ; simulcast_streams . drain ( ) . map ( | ( _ , v ) | v ) . collect ( ) } ; for ss in simulcast_streams { match ss . close ( ) . await { Ok ( _ ) => { } Err ( err ) => { close_errs . push ( Error :: new ( format ! ( " " ss get_ssrc ( ) err ) ) ) ; } } ; } } if let Some ( conn ) = self . conn ( ) . await { // dtls_transport connection may be closed on sctp close. match conn . close ( ) . await { Ok ( _ ) => { } Err ( err ) => { if err . to_string ( ) != dtls :: Error :: ErrConnClosed . to_string ( ) { close_errs . push ( err . into ( ) ) ; } } } } self . state_change ( RTCDtlsTransportState :: Closed ) . await ; flatten_errs ( close_errs ) }
stops and closes the DTLSTransport object.
stops and closes the DTLSTransport object .
&self