Skip to content

Commit

Permalink
io_uring: add common error conditions (BrokenPipe, ConnectionReset)
Browse files Browse the repository at this point in the history
  • Loading branch information
recursiveGecko committed Aug 9, 2023
1 parent 7b4a0e8 commit 7421cc9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/backend/io_uring.zig
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,8 @@ pub const Completion = struct {
@intCast(res)
else switch (@as(std.os.E, @enumFromInt(-res))) {
.CANCELED => error.Canceled,
.PIPE => error.BrokenPipe,
.CONNRESET => error.ConnectionReset,
else => |errno| std.os.unexpectedErrno(errno),
},
},
Expand All @@ -701,6 +703,8 @@ pub const Completion = struct {
@intCast(res)
else switch (@as(std.os.E, @enumFromInt(-res))) {
.CANCELED => error.Canceled,
.PIPE => error.BrokenPipe,
.CONNRESET => error.ConnectionReset,
else => |errno| std.os.unexpectedErrno(errno),
},
},
Expand Down Expand Up @@ -797,6 +801,7 @@ pub const Completion = struct {

return switch (@as(std.os.E, @enumFromInt(-res))) {
.CANCELED => error.Canceled,
.CONNRESET => error.ConnectionReset,
else => |errno| std.os.unexpectedErrno(errno),
};
}
Expand Down Expand Up @@ -1051,6 +1056,7 @@ pub const ReadError = error{
EOF,
Canceled,
Unexpected,
ConnectionReset,
};

pub const ShutdownError = error{
Expand All @@ -1060,6 +1066,8 @@ pub const ShutdownError = error{

pub const WriteError = error{
Canceled,
BrokenPipe,
ConnectionReset,
Unexpected,
};

Expand Down

0 comments on commit 7421cc9

Please sign in to comment.