authorgravatar for 63115601+lithdew@users.noreply.github.comKenta Iwasaki <63115601+lithdew@users.noreply.github.com> 2020-09-04 02:57:08+09:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-09-03 13:57:08-04:00
log50e39069518a0c2643cd5e3189ad087b5fbed0c6
treea8998ecbe97dfe5a5616191440ae5758dd613a66
parent969547902b49d6b21af762fb24ed591789b9d2a4
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

os: return error.SocketNotListening for EINVAL on accept (#6226)


2 files changed, 7 insertions(+), 1 deletions(-)

lib/std/net.zig+3
......@@ -1641,6 +1641,9 @@ pub const StreamServer = struct {
16411641 /// by the socket buffer limits, not by the system memory.
16421642 SystemResources,
16431643
1644 /// Socket is not listening for new connections.
1645 SocketNotListening,
1646
16441647 ProtocolFailure,
16451648
16461649 /// Firewall rules forbid connection.
lib/std/os.zig+4-1
......@@ -2802,6 +2802,9 @@ pub const AcceptError = error{
28022802 /// by the socket buffer limits, not by the system memory.
28032803 SystemResources,
28042804
2805 /// Socket is not listening for new connections.
2806 SocketNotListening,
2807
28052808 ProtocolFailure,
28062809
28072810 /// Firewall rules forbid connection.
......@@ -2870,7 +2873,7 @@ pub fn accept(
28702873 EBADF => unreachable, // always a race condition
28712874 ECONNABORTED => return error.ConnectionAborted,
28722875 EFAULT => unreachable,
2873 EINVAL => unreachable,
2876 EINVAL => return error.SocketNotListening,
28742877 ENOTSOCK => unreachable,
28752878 EMFILE => return error.ProcessFdQuotaExceeded,
28762879 ENFILE => return error.SystemFdQuotaExceeded,