From 68e7726478f89ca27127e68b79112c12ac7415f7 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 16 Feb 2021 11:01:17 -0700 Subject: std.fs.net.Stream: add writev and writevAll I noticed that the write function does not properly use non-blocking I/O. This file needs to be reworked for evented I/O to properly take advantage of non-blocking writes to network sockets. --- lib/std/fs/file.zig | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/std/fs') diff --git a/lib/std/fs/file.zig b/lib/std/fs/file.zig index 5138555723..baea3b4e7f 100644 --- a/lib/std/fs/file.zig +++ b/lib/std/fs/file.zig @@ -587,6 +587,7 @@ pub const File = struct { } /// See https://github.com/ziglang/zig/issues/7699 + /// See equivalent function: `std.net.Stream.writev`. pub fn writev(self: File, iovecs: []const os.iovec_const) WriteError!usize { if (is_windows) { // TODO improve this to use WriteFileScatter @@ -605,6 +606,7 @@ pub const File = struct { /// The `iovecs` parameter is mutable because this function needs to mutate the fields in /// order to handle partial writes from the underlying OS layer. /// See https://github.com/ziglang/zig/issues/7699 + /// See equivalent function: `std.net.Stream.writevAll`. pub fn writevAll(self: File, iovecs: []os.iovec_const) WriteError!void { if (iovecs.len == 0) return; -- cgit v1.2.3