std.os.read can fail with ConnectionResetByPeer

This commit is contained in:
Andrew Kelley 2019-11-04 14:39:59 -05:00
parent aaf50970a8
commit 6c17282062
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9

View File

@ -274,6 +274,7 @@ pub const ReadError = error{
IsDir,
OperationAborted,
BrokenPipe,
ConnectionResetByPeer,
/// This error occurs when no global event loop is configured,
/// and reading from the file descriptor would block.
@ -320,6 +321,7 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize {
EISDIR => return error.IsDir,
ENOBUFS => return error.SystemResources,
ENOMEM => return error.SystemResources,
ECONNRESET => return error.ConnectionResetByPeer,
else => |err| return unexpectedErrno(err),
}
}