os.zig: add ETIMEDOUT error case to read function
According to documentation ETIMEDOUT (110) is a valid error code for the read function. I just had my long-running (been running for about 7 weeks) network program crash because it did not handle the ETIMEDOUT error code from "read".master
parent
9b788b765c
commit
75b699b2c6
|
@ -292,6 +292,7 @@ pub const ReadError = error{
|
||||||
OperationAborted,
|
OperationAborted,
|
||||||
BrokenPipe,
|
BrokenPipe,
|
||||||
ConnectionResetByPeer,
|
ConnectionResetByPeer,
|
||||||
|
ConnectionTimedOut,
|
||||||
|
|
||||||
/// This error occurs when no global event loop is configured,
|
/// This error occurs when no global event loop is configured,
|
||||||
/// and reading from the file descriptor would block.
|
/// and reading from the file descriptor would block.
|
||||||
|
@ -351,6 +352,7 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize {
|
||||||
ENOBUFS => return error.SystemResources,
|
ENOBUFS => return error.SystemResources,
|
||||||
ENOMEM => return error.SystemResources,
|
ENOMEM => return error.SystemResources,
|
||||||
ECONNRESET => return error.ConnectionResetByPeer,
|
ECONNRESET => return error.ConnectionResetByPeer,
|
||||||
|
ETIMEDOUT => return error.ConnectionTimedOut,
|
||||||
else => |err| return unexpectedErrno(err),
|
else => |err| return unexpectedErrno(err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -837,6 +837,7 @@ pub const NativeTargetInfo = struct {
|
||||||
error.BrokenPipe => return error.UnableToReadElfFile,
|
error.BrokenPipe => return error.UnableToReadElfFile,
|
||||||
error.Unseekable => return error.UnableToReadElfFile,
|
error.Unseekable => return error.UnableToReadElfFile,
|
||||||
error.ConnectionResetByPeer => return error.UnableToReadElfFile,
|
error.ConnectionResetByPeer => return error.UnableToReadElfFile,
|
||||||
|
error.ConnectionTimedOut => return error.UnableToReadElfFile,
|
||||||
error.Unexpected => return error.Unexpected,
|
error.Unexpected => return error.Unexpected,
|
||||||
error.InputOutput => return error.FileSystem,
|
error.InputOutput => return error.FileSystem,
|
||||||
};
|
};
|
||||||
|
|
|
@ -841,6 +841,7 @@ export fn stage2_libc_parse(stage1_libc: *Stage2LibCInstallation, libc_file_z: [
|
||||||
error.EndOfStream => return .EndOfFile,
|
error.EndOfStream => return .EndOfFile,
|
||||||
error.IsDir => return .IsDir,
|
error.IsDir => return .IsDir,
|
||||||
error.ConnectionResetByPeer => unreachable,
|
error.ConnectionResetByPeer => unreachable,
|
||||||
|
error.ConnectionTimedOut => unreachable,
|
||||||
error.OutOfMemory => return .OutOfMemory,
|
error.OutOfMemory => return .OutOfMemory,
|
||||||
error.Unseekable => unreachable,
|
error.Unseekable => unreachable,
|
||||||
error.SharingViolation => return .SharingViolation,
|
error.SharingViolation => return .SharingViolation,
|
||||||
|
|
Loading…
Reference in New Issue