From 6031321a78e3df5304f555ba356a4482469e7d56 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Mon, 9 Jul 2018 15:28:09 +0200 Subject: [socket-nif] Add support for socket (level socket) option debug The socket option (level socket) debug is now supported. To actually set this option, the user must have the proper "authority" (CAP_NET_ADMIN capability or an effective user ID of 0). OTP-14831 --- lib/kernel/test/socket_server.erl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/kernel/test') diff --git a/lib/kernel/test/socket_server.erl b/lib/kernel/test/socket_server.erl index 52b0d5b558..54e13cc92d 100644 --- a/lib/kernel/test/socket_server.erl +++ b/lib/kernel/test/socket_server.erl @@ -260,17 +260,24 @@ acceptor_do_init(Domain, Type, Proto) -> end, F = fun(X) -> case socket:getopt(Sock, socket, X) of {ok, V} -> f("~p", [V]); - {error, _} -> f("~w", [X]) + {error, _} -> "-" end end, - i("(socket) open (~s,~s,~s) - try find (local) address", - [F(domain), F(type), F(protocol)]), + i("(socket) open (~s,~s,~s): " + "~n debug: ~s" + "~n prio: ~s" + "~n try find (local) address", + [F(domain), F(type), F(protocol), F(debug), F(priority)]), Addr = which_addr(Domain), SA = #{family => Domain, addr => Addr}, i("found (~p) - try (socket) bind", [Addr]), + %% ok = socket:setopt(Sock, otp, debug, true), + %% ok = socket:setopt(Sock, socket, debug, 1), %% must have rights!! Port = case socket:bind(Sock, SA) of {ok, P} -> + %% ok = socket:setopt(Sock, socket, debug, 0), %% must have rights!! + %% ok = socket:setopt(Sock, otp, debug, false), P; {error, BReason} -> throw({bind, BReason}) -- cgit v1.2.3