fix std.os.accept4
- add WouldBlock to list of errors in AcceptError - ptrCast addr_size to the system's socklen_t, instead of assuming it's usizemaster
parent
fafd1fd480
commit
bf16fc210b
|
@ -1630,6 +1630,10 @@ pub const AcceptError = error{
|
||||||
|
|
||||||
/// Firewall rules forbid connection.
|
/// Firewall rules forbid connection.
|
||||||
BlockedByFirewall,
|
BlockedByFirewall,
|
||||||
|
|
||||||
|
/// This error occurs when no global event loop is configured,
|
||||||
|
/// and accepting from the socket would block.
|
||||||
|
WouldBlock,
|
||||||
} || UnexpectedError;
|
} || UnexpectedError;
|
||||||
|
|
||||||
/// Accept a connection on a socket.
|
/// Accept a connection on a socket.
|
||||||
|
@ -1661,7 +1665,7 @@ pub fn accept4(
|
||||||
flags: u32,
|
flags: u32,
|
||||||
) AcceptError!i32 {
|
) AcceptError!i32 {
|
||||||
while (true) {
|
while (true) {
|
||||||
const rc = system.accept4(sockfd, addr, addr_size, flags);
|
const rc = system.accept4(sockfd, addr, @ptrCast(*system.socklen_t, addr_size), flags);
|
||||||
switch (errno(rc)) {
|
switch (errno(rc)) {
|
||||||
0 => return @intCast(i32, rc),
|
0 => return @intCast(i32, rc),
|
||||||
EINTR => continue,
|
EINTR => continue,
|
||||||
|
|
Loading…
Reference in New Issue