pub fn listen_uds(mut self, lst: std::os::unix::net::UnixListener) -> io::Result<Self> {
        use actix_http::Protocol;
        use actix_rt::net::UnixStream;
        use actix_service::{fn_service, ServiceFactoryExt as _};

        let cfg = self.config.clone();
        let factory = self.factory.clone();
        let socket_addr =
            net::SocketAddr::new(net::IpAddr::V4(net::Ipv4Addr::new(127, 0, 0, 1)), 8080);
        self.sockets.push(Socket {
            scheme: "http",
            addr: socket_addr,
        });

        let addr = lst.local_addr()?;
        let name = format!("actix-web-service-{:?}", addr);
        let on_connect_fn = self.on_connect_fn.clone();

        self.builder = self.builder.listen_uds(name, lst, move || {
            let c = cfg.lock().unwrap();
            let config = AppConfig::new(
                false,
                c.host.clone().unwrap_or_else(|| format!("{}", socket_addr)),
                socket_addr,
            );

            fn_service(|io: UnixStream| async { Ok((io, Protocol::Http1, None)) }).and_then({
                let mut svc = HttpService::build()
                    .keep_alive(c.keep_alive)
                    .client_timeout(c.client_timeout)
                    .client_disconnect(c.client_shutdown);

                if let Some(handler) = on_connect_fn.clone() {
                    svc = svc
                        .on_connect_ext(move |io: &_, ext: _| (&*handler)(io as &dyn Any, ext));
                }

                let fac = factory()
                    .into_factory()
                    .map_err(|err| err.into().error_response());

                svc.finish(map_config(fac, move |_| config.clone()))
            })
        })?;
        Ok(self)
    }
/// Start listening for unix domain (UDS) connections on existing listener.
Start listening for unix domain (UDS) connections on existing listener.
Start listening for unix domain ( UDS ) connections on existing listener .
pub fn listen_uds(mut self, lst: std::os::unix::net::UnixListener) -> io::Result<Self> {
        use actix_http::Protocol;
        use actix_rt::net::UnixStream;
        use actix_service::{fn_service, ServiceFactoryExt as _};
        let cfg = self.config.clone();
        let factory = self.factory.clone();
        let socket_addr =
            net::SocketAddr::new(net::IpAddr::V4(net::Ipv4Addr::new(127, 0, 0, 1)), 8080);
        self.sockets.push(Socket {
            scheme: "http",
            addr: socket_addr,
        });
        let addr = lst.local_addr()?;
        let name = format!("actix-web-service-{:?}", addr);
        let on_connect_fn = self.on_connect_fn.clone();
        self.builder = self.builder.listen_uds(name, lst, move || {
            let c = cfg.lock().unwrap();
            let config = AppConfig::new(
                false,
                c.host.clone().unwrap_or_else(|| format!("{}", socket_addr)),
                socket_addr,
            );
            fn_service(|io: UnixStream| async { Ok((io, Protocol::Http1, None)) }).and_then({
                let mut svc = HttpService::build()
                    .keep_alive(c.keep_alive)
                    .client_timeout(c.client_timeout)
                    .client_disconnect(c.client_shutdown);
                if let Some(handler) = on_connect_fn.clone() {
                    svc = svc
                        .on_connect_ext(move |io: &_, ext: _| (&*handler)(io as &dyn Any, ext));
                }
                let fac = factory()
                    .into_factory()
                    .map_err(|err| err.into().error_response());
                svc.finish(map_config(fac, move |_| config.clone()))
            })
        })?;
        Ok(self)
    }
pub fn listen_uds ( mut self , lst : std :: os :: unix :: net :: UnixListener ) -> io :: Result < Self > { use actix_http :: Protocol ; use actix_rt :: net :: UnixStream ; use actix_service :: { fn_service , ServiceFactoryExt as _ } ; let cfg = self . config . clone ( ) ; let factory = self . factory . clone ( ) ; let socket_addr = net :: SocketAddr :: new ( net :: IpAddr :: V4 ( net :: Ipv4Addr :: new ( 127 , 0 , 0 , 1 ) ) , 8080 ) ; self . sockets . push ( Socket { scheme : " " , addr : socket_addr , } ) ; let addr = lst . local_addr ( ) ? ; let name = format ! ( " " addr ) ; let on_connect_fn = self . on_connect_fn . clone ( ) ; self . builder = self . builder . listen_uds ( name , lst , move | | { let c = cfg . lock ( ) . unwrap ( ) ; let config = AppConfig :: new ( false , c . host . clone ( ) . unwrap_or_else ( | | format ! ( " " socket_addr ) ) , socket_addr , ) ; fn_service ( | io : UnixStream | async { Ok ( ( io , Protocol :: Http1 , None ) ) } ) . and_then ( { let mut svc = HttpService :: build ( ) . keep_alive ( c . keep_alive ) . client_timeout ( c . client_timeout ) . client_disconnect ( c . client_shutdown ) ; if let Some ( handler ) = on_connect_fn . clone ( ) { svc = svc . on_connect_ext ( move | io : & _ , ext : _ | ( & * handler ) ( io as & dyn Any , ext ) ) ; } let fac = factory ( ) . into_factory ( ) . map_err ( | err | err . into ( ) . error_response ( ) ) ; svc . finish ( map_config ( fac , move | _ | config . clone ( ) ) ) } ) } ) ? ; Ok ( self ) }
Start listening for unix domain (UDS) connections on existing listener.
Start listening for unix domain ( UDS ) connections on existing listener .
mut self
lst
std::os::unix::net::UnixListener
mut self
lst
std::os::unix::net::UnixListener