pub async fn serve<S>(self, mut incoming: S)
    where
        S: Stream<Item = io::Result<TcpStream>> + Unpin,
    {
        let handlers = Arc::new(self.handlers);
        while let Some(conn) = incoming.next().await {
            let conn = match conn {
                Ok(conn) => conn,
                Err(err) => {
                    error!("error accepting connection: {}", err);
                    continue;
                }
            };
            // Set TCP_NODELAY to disable tinygram prevention (Nagle's
            // algorithm), which forces a 40ms delay between each query
            // on linux. According to John Nagle [0], the true problem
            // is delayed acks, but disabling those is a receive-side
            // operation (TCP_QUICKACK), and we can't always control the
            // client. PostgreSQL sets TCP_NODELAY on both sides of its
            // sockets, so it seems sane to just do the same.
            //
            // If set_nodelay fails, it's a programming error, so panic.
            //
            // [0]: https://news.ycombinator.com/item?id=10608356
            conn.set_nodelay(true).expect("set_nodelay failed");
            tokio::spawn(handle_connection(handlers.clone(), conn));
        }
    }
/// Serves incoming TCP traffic from `listener`.
Serves incoming TCP traffic from `listener`.
Serves incoming TCP traffic from ` listener ` .
pub async fn serve<S>(self, mut incoming: S)
    where
        S: Stream<Item = io::Result<TcpStream>> + Unpin,
    {
        let handlers = Arc::new(self.handlers);
        while let Some(conn) = incoming.next().await {
            let conn = match conn {
                Ok(conn) => conn,
                Err(err) => {
                    error!("error accepting connection: {}", err);
                    continue;
                }
            };
            // Set TCP_NODELAY to disable tinygram prevention (Nagle's
            // algorithm), which forces a 40ms delay between each query
            // on linux. According to John Nagle [0], the true problem
            // is delayed acks, but disabling those is a receive-side
            // operation (TCP_QUICKACK), and we can't always control the
            // client. PostgreSQL sets TCP_NODELAY on both sides of its
            // sockets, so it seems sane to just do the same.
            //
            // If set_nodelay fails, it's a programming error, so panic.
            //
            // [0]: https://news.ycombinator.com/item?id=10608356
            conn.set_nodelay(true).expect("set_nodelay failed");
            tokio::spawn(handle_connection(handlers.clone(), conn));
        }
    }
pub async fn serve < S > ( self , mut incoming : S ) where S : Stream < Item = io :: Result < TcpStream > > + Unpin , { let handlers = Arc :: new ( self . handlers ) ; while let Some ( conn ) = incoming . next ( ) . await { let conn = match conn { Ok ( conn ) => conn , Err ( err ) => { error ! ( " " err ) ; continue ; } } ; // Set TCP_NODELAY to disable tinygram prevention (Nagle's // algorithm), which forces a 40ms delay between each query // on linux. According to John Nagle [0], the true problem // is delayed acks, but disabling those is a receive-side // operation (TCP_QUICKACK), and we can't always control the // client. PostgreSQL sets TCP_NODELAY on both sides of its // sockets, so it seems sane to just do the same. // // If set_nodelay fails, it's a programming error, so panic. // // [0]: https://news.ycombinator.com/item?id=10608356 conn . set_nodelay ( true ) . expect ( " " ) ; tokio :: spawn ( handle_connection ( handlers . clone ( ) , conn ) ) ; } }
Serves incoming TCP traffic from `listener`.
Serves incoming TCP traffic from ` listener ` .
self
incoming
S
self
incoming
S