From 5329726352f8b983e419b6206a85c15cc8836676 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Mon, 9 Jul 2018 18:41:07 +0200 Subject: [socket-nif] Add support for socket (level socket) option peek_off The socket option (level socket) peek_off is now supported. OTP-14831 --- erts/preloaded/ebin/socket.beam | Bin 43652 -> 43668 bytes erts/preloaded/src/socket.erl | 8 +++++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'erts/preloaded') diff --git a/erts/preloaded/ebin/socket.beam b/erts/preloaded/ebin/socket.beam index 508c669895..9c10182bb4 100644 Binary files a/erts/preloaded/ebin/socket.beam and b/erts/preloaded/ebin/socket.beam differ diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl index 66ae9c7fd8..8f489bd681 100644 --- a/erts/preloaded/src/socket.erl +++ b/erts/preloaded/src/socket.erl @@ -478,7 +478,7 @@ %% -define(SOCKET_OPT_SOCK_MARK, 12). %% -define(SOCKET_OPT_SOCK_OOBINLLINE, 13). %% -define(SOCKET_OPT_SOCK_PASSCRED, 14). -%% -define(SOCKET_OPT_SOCK_PEEK_OFF, 16). +-define(SOCKET_OPT_SOCK_PEEK_OFF, 16). %% -define(SOCKET_OPT_SOCK_PEEKCRED, 17). -define(SOCKET_OPT_SOCK_PRIORITY, 18). -define(SOCKET_OPT_SOCK_PROTOCOL, 19). @@ -1840,6 +1840,8 @@ enc_setopt_value(socket, linger, abort, D, T, P) -> enc_setopt_value(socket, linger, {OnOff, Secs} = V, _D, _T, _P) when is_boolean(OnOff) andalso is_integer(Secs) andalso (Secs >= 0) -> V; +enc_setopt_value(socket, peek_off, V, _D, _T, _P) when is_integer(V) -> + V; enc_setopt_value(socket, priority, V, _D, _T, _P) when is_integer(V) -> V; enc_setopt_value(socket, rcvbuf, V, _D, _T, _P) when is_integer(V) -> @@ -2068,8 +2070,8 @@ enc_sockopt_key(socket, oobinline = Opt, _Dir, _D, _T, _P) -> not_supported(Opt); enc_sockopt_key(socket = L, passcred = Opt, _Dir, _D, _T, _P) -> not_supported({L, Opt}); -enc_sockopt_key(socket = L, peek_off = Opt, _Dir, local = _D, _T, _P) -> - not_supported({L, Opt}); +enc_sockopt_key(socket = _L, peek_off = _Opt, _Dir, local = _D, _T, _P) -> + ?SOCKET_OPT_SOCK_PEEK_OFF; enc_sockopt_key(socket = L, peekcred = Opt, get = _Dir, _D, _T, _P) -> not_supported({L, Opt}); enc_sockopt_key(socket, priority = _Opt, _Dir, _D, _T, _P) -> -- cgit v1.2.3