Function fill [src]
Refills the read buffer with data from the connection.
Prototype
pub fn fill(conn: *Connection) ReadError!void
Parameters
conn: *Connection
Possible Errors
Source
pub fn fill(conn: *Connection) ReadError!void {
if (conn.read_end != conn.read_start) return;
var iovecs = [1]std.posix.iovec{
.{ .base = &conn.read_buf, .len = conn.read_buf.len },
};
const nread = try conn.readvDirect(&iovecs);
if (nread == 0) return error.EndOfStream;
conn.read_start = 0;
conn.read_end = @intCast(nread);
}