/// Flush the write buffer to the socket
Flush the write buffer to the socket
Flush the write buffer to the socket
fn poll_flush(&mut self) -> Poll<(), io::Error> {
        // As long as there is buffered data to write, try to write it.
        while !self.wr.is_empty() {
            // `try_nb` is kind of like `try_ready`, but for operations that
            // return `io::Result` instead of `Async`.
            //
            // In the case of `io::Result`, an error of `WouldBlock` is
            // equivalent to `Async::NotReady.
            let n = try_nb!(self.socket.write(&self.wr));
            // As long as the wr is not empty, a successful write should
            // never write 0 bytes.
            assert!(n > 0);
            // This discards the first `n` bytes of the buffer.
            let _ = self.wr.split_to(n);
        }
        Ok(Async::Ready(()))
    }
fn poll_flush ( & mut self ) -> Poll < ( ) , io :: Error > { // As long as there is buffered data to write, try to write it. while ! self . wr . is_empty ( ) { // `try_nb` is kind of like `try_ready`, but for operations that // return `io::Result` instead of `Async`. // // In the case of `io::Result`, an error of `WouldBlock` is // equivalent to `Async::NotReady. let n = try_nb ! ( self socket write ( self wr ) ) ; // As long as the wr is not empty, a successful write should // never write 0 bytes. assert ! ( n 0 ) ; // This discards the first `n` bytes of the buffer. let _ = self . wr . split_to ( n ) ; } Ok ( Async :: Ready ( ( ) ) ) }
Flush the write buffer to the socket
Flush the write buffer to the socket
&mut self