diff options
author | Micael Karlberg <[email protected]> | 2018-07-09 14:10:35 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2018-09-18 14:50:18 +0200 |
commit | d45e3bf3dfeda0e849b07a9a7a19e50a52b04c35 (patch) | |
tree | 5070c73bdd508a484f2ae9ad56de05a851465bf8 /lib | |
parent | 6632cb103336786f3ca12f9d1f1d3338fc76c237 (diff) | |
download | otp-d45e3bf3dfeda0e849b07a9a7a19e50a52b04c35.tar.gz otp-d45e3bf3dfeda0e849b07a9a7a19e50a52b04c35.tar.bz2 otp-d45e3bf3dfeda0e849b07a9a7a19e50a52b04c35.zip |
[socket-nif] Add support for socket (level socket) options domain and protocol
Make it possible to *get* the socket options domain and
protocol (in addition to type).
OTP-14831
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kernel/test/socket_server.erl | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/kernel/test/socket_server.erl b/lib/kernel/test/socket_server.erl index 02fc6fc26d..cf7e349a3d 100644 --- a/lib/kernel/test/socket_server.erl +++ b/lib/kernel/test/socket_server.erl @@ -258,7 +258,13 @@ acceptor_do_init(Domain, Type, Proto) -> {error, OReason} -> throw({open, OReason}) end, - i("(socket) open - try find (local) address"), + F = fun(X) -> case socket:getopt(Sock, socket, X) of + {ok, V} -> f("~p", [V]); + {error, _} -> f("~w", [X]) + end + end, + i("(socket) open (~s,~s,~s) - try find (local) address", + [F(domain), F(type), F(protocol)]), Addr = which_addr(Domain), SA = #{family => Domain, addr => Addr}, @@ -392,7 +398,13 @@ handler_init(Manager, ID, Peek, Sock) -> {handler, Pid, Ref, continue} -> i("got continue"), handler_reply(Pid, Ref, ok), - {ok, Type} = socket:getopt(Sock, socket, type), + {ok, Domain} = socket:getopt(Sock, socket, domain), + {ok, Type} = socket:getopt(Sock, socket, type), + {ok, Proto} = socket:getopt(Sock, socket, protocol), + i("got continue when: " + "~n Domain: ~p" + "~n Type: ~p" + "~n Protocol: ~p", [Domain, Type, Proto]), %% socket:setopt(Socket, otp, debug, true), handler_loop(#handler{peek = Peek, manager = Manager, |