/// Spawns a background task that watches for TLS configuration updates and creates an augmented
/// configuration with the provided ALPN protocols. The returned server uses this ALPN-aware
/// configuration.
Spawns a background task that watches for TLS configuration updates and creates an augmented
configuration with the provided ALPN protocols. The returned server uses this ALPN-aware
configuration.
Spawns a background task that watches for TLS configuration updates and creates an augmented configuration with the provided ALPN protocols . The returned server uses this ALPN - aware configuration .
pub fn spawn_with_alpn(self, alpn_protocols: Vec<Vec<u8>>) -> Result<Self, LostStore> {
        if alpn_protocols.is_empty() {
            return Ok(self);
        }
        let mut orig_rx = self.rx;
        let mut c = (**orig_rx.borrow_and_update()).clone();
        c.alpn_protocols = alpn_protocols.clone();
        let (tx, rx) = watch::channel(c.into());
        // Spawn a background task that watches the optional server configuration and publishes it
        // as a reliable channel, including any ALPN overrides.
        //
        // The background task completes when the original sender is closed or when all receivers
        // are dropped.
        tokio::spawn(async move {
            loop {
                tokio::select! {
                    _ = tx.closed() => {
                        debug!("ALPN TLS config receivers dropped");
                        return;
                    }
                    res = orig_rx.changed() => {
                        if res.is_err() {
                            debug!("TLS config sender closed");
                            return;
                        }
                    }
                }
                let mut c = (*orig_rx.borrow().clone()).clone();
                c.alpn_protocols = alpn_protocols.clone();
                let _ = tx.send(c.into());
            }
        });
        Ok(Self::new(self.name, rx))
    }
pub fn spawn_with_alpn ( self , alpn_protocols : Vec < Vec < u8 > > ) -> Result < Self , LostStore > { if alpn_protocols . is_empty ( ) { return Ok ( self ) ; } let mut orig_rx = self . rx ; let mut c = ( * * orig_rx . borrow_and_update ( ) ) . clone ( ) ; c . alpn_protocols = alpn_protocols . clone ( ) ; let ( tx , rx ) = watch :: channel ( c . into ( ) ) ; // Spawn a background task that watches the optional server configuration and publishes it // as a reliable channel, including any ALPN overrides. // // The background task completes when the original sender is closed or when all receivers // are dropped. tokio :: spawn ( async move { loop { tokio :: select ! { tx closed ( ) { debug ( " " ) return } res orig_rx changed ( ) { if res is_err ( ) { debug ( " " ) return } } } let mut c = ( * orig_rx . borrow ( ) . clone ( ) ) . clone ( ) ; c . alpn_protocols = alpn_protocols . clone ( ) ; let _ = tx . send ( c . into ( ) ) ; } } ) ; Ok ( Self :: new ( self . name , rx ) ) }
Spawns a background task that watches for TLS configuration updates and creates an augmented
configuration with the provided ALPN protocols.
Spawns a background task that watches for TLS configuration updates and creates an augmented configuration with the provided ALPN protocols .
self
alpn_protocols
Vec<Vec<u8>>