aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os.zig
diff options
context:
space:
mode:
authorMichael Dusan <michael.dusan@gmail.com>2021-04-11 17:40:19 -0400
committerMichael Dusan <michael.dusan@gmail.com>2021-04-11 17:40:19 -0400
commit93cf9560b13619159efb3ca12eeeb13d6031ad85 (patch)
tree4b5857db65268b6e3a41fc436082da7b100647b6 /lib/std/os.zig
parent86b31394c9d73b0f753918cea4f08ce8d7a26119 (diff)
parent82a31aac9b955213f47ff3b2a2c7eb932fdbe294 (diff)
downloadzig-93cf9560b13619159efb3ca12eeeb13d6031ad85.tar.gz
zig-93cf9560b13619159efb3ca12eeeb13d6031ad85.zip
Merge remote-tracking branch 'origin/master' into llvm12
Diffstat (limited to 'lib/std/os.zig')
-rw-r--r--lib/std/os.zig7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/std/os.zig b/lib/std/os.zig
index e4bd96de05..9826ba46f1 100644
--- a/lib/std/os.zig
+++ b/lib/std/os.zig
@@ -3254,6 +3254,9 @@ pub const ConnectError = error{
/// Connection was reset by peer before connect could complete.
ConnectionResetByPeer,
+
+ /// Socket is non-blocking and already has a pending connection in progress.
+ ConnectionPending,
} || UnexpectedError;
/// Initiate a connection on a socket.
@@ -3294,7 +3297,7 @@ pub fn connect(sock: socket_t, sock_addr: *const sockaddr, len: socklen_t) Conne
EADDRNOTAVAIL => return error.AddressNotAvailable,
EAFNOSUPPORT => return error.AddressFamilyNotSupported,
EAGAIN, EINPROGRESS => return error.WouldBlock,
- EALREADY => unreachable, // The socket is nonblocking and a previous connection attempt has not yet been completed.
+ EALREADY => return error.ConnectionPending,
EBADF => unreachable, // sockfd is not a valid open file descriptor.
ECONNREFUSED => return error.ConnectionRefused,
ECONNRESET => return error.ConnectionResetByPeer,
@@ -3325,7 +3328,7 @@ pub fn getsockoptError(sockfd: fd_t) ConnectError!void {
EADDRNOTAVAIL => return error.AddressNotAvailable,
EAFNOSUPPORT => return error.AddressFamilyNotSupported,
EAGAIN => return error.SystemResources,
- EALREADY => unreachable, // The socket is nonblocking and a previous connection attempt has not yet been completed.
+ EALREADY => return error.ConnectionPending,
EBADF => unreachable, // sockfd is not a valid open file descriptor.
ECONNREFUSED => return error.ConnectionRefused,
EFAULT => unreachable, // The socket structure address is outside the user's address space.