fn call()

in http-common/src/connector.rs [409:455]


    fn call(&mut self, _req: hyper::Uri) -> Self::Future {
        match self {
            Connector::Tcp { host, port } => {
                let (host, port) = (host.clone(), *port);
                let f = async move {
                    let inner = tokio::net::TcpStream::connect((&*host, port)).await?;
                    Ok(AsyncStream::Tcp(inner))
                };
                Box::pin(f)
            }

            Connector::Unix { socket_path } => {
                let socket_path = socket_path.clone();
                let f = async move {
                    let inner = tokio::net::UnixStream::connect(&*socket_path).await?;
                    Ok(AsyncStream::Unix(inner))
                };
                Box::pin(f)
            }

            Connector::Fd { fd } => {
                let fd = *fd;

                let f = async move {
                    if is_unix_fd(fd)? {
                        let stream: std::os::unix::net::UnixStream =
                            unsafe { std::os::unix::io::FromRawFd::from_raw_fd(fd) };

                        stream.set_nonblocking(true)?;
                        let stream = tokio::net::UnixStream::from_std(stream)?;

                        Ok(AsyncStream::Unix(stream))
                    } else {
                        let stream: std::net::TcpStream =
                            unsafe { std::os::unix::io::FromRawFd::from_raw_fd(fd) };

                        stream.set_nonblocking(true)?;
                        let stream = tokio::net::TcpStream::from_std(stream)?;

                        Ok(AsyncStream::Tcp(stream))
                    }
                };

                Box::pin(f)
            }
        }
    }