Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/Socket.zig
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub const Reader = struct {

fn stream(r: *Io.Reader, w: *Io.Writer, limit: Io.Limit) Io.Reader.StreamError!usize {
const self: *Reader = @fieldParentPtr("interface", r);
const buf = limit.slice(w.unusedCapacitySlice());
const buf = limit.slice(try w.writableSliceGreedy(1));

while (true) {
var iov: [1]posix.iovec = .{
Expand Down
3 changes: 2 additions & 1 deletion src/connection.zig
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ pub const Connection = struct {

fn stream(r: *Io.Reader, w: *Io.Writer, limit: Io.Limit) Io.Reader.StreamError!usize {
const self: *Reader = @fieldParentPtr("interface", r);
const n = self.conn.read(limit.slice(w.unusedCapacitySlice())) catch |err| {
const buf = limit.slice(try w.writableSliceGreedy(1));
const n = self.conn.read(buf) catch |err| {
self.err = err;
if (err == error.EndOfStream) return error.EndOfStream;
return error.ReadFailed;
Expand Down
Loading