aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/socket_server.erl
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2018-07-20 12:28:19 +0200
committerMicael Karlberg <[email protected]>2018-09-18 14:50:18 +0200
commit3f1d17f3031b71ca6ff1f8e051859ad55e55822b (patch)
tree3939712ac67454970e3fa3501705aa5e9cd4ede5 /lib/kernel/test/socket_server.erl
parentbd36af21717b138c91724128e592b3fc587bb07a (diff)
downloadotp-3f1d17f3031b71ca6ff1f8e051859ad55e55822b.tar.gz
otp-3f1d17f3031b71ca6ff1f8e051859ad55e55822b.tar.bz2
otp-3f1d17f3031b71ca6ff1f8e051859ad55e55822b.zip
[socket-nif] Add support for socket (level socket) option(s) [rcv|snd]timeo
Added support for socket level socket option RCVTIMEO and SNDTIMEO. These are both a little strange, at least on linux. See the man pages for more info. OTP-14831
Diffstat (limited to 'lib/kernel/test/socket_server.erl')
-rw-r--r--lib/kernel/test/socket_server.erl21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/kernel/test/socket_server.erl b/lib/kernel/test/socket_server.erl
index 986363b56d..80de3574d1 100644
--- a/lib/kernel/test/socket_server.erl
+++ b/lib/kernel/test/socket_server.erl
@@ -141,11 +141,14 @@ do_manager_init(Domain, dgram = Type, Proto, Peek) ->
"~n debug: ~s"
"~n prio: ~s"
"~n rcvbuf: ~s"
+ "~n rcvtimeo: ~s"
"~n sndbuf: ~s"
+ "~n sndtimeo: ~s"
"~n => try find (local) address",
[F(domain), F(type), F(protocol),
F(broadcast), F(dontroute), F(keepalive), F(reuseaddr), F(linger),
- F(debug), F(priority), F(rcvbuf), F(sndbuf)]),
+ F(debug), F(priority),
+ F(rcvbuf), F(rcvtimeo), F(sndbuf), F(sndtimeo)]),
Addr = which_addr(Domain),
SA = #{family => Domain,
addr => Addr},
@@ -315,7 +318,7 @@ manager_stream_init(Sock, ID, NumAcceptors, Acc)
case acceptor_start(Sock, ID) of
{ok, {Pid, MRef}} ->
i("acceptor ~w (~p) started", [ID, Pid]),
- ?LIB:sleep(5000),
+ ?LIB:sleep(2000),
manager_stream_init(Sock, ID+1, NumAcceptors-1,
[{ID, Pid, MRef}|Acc]);
{error, Reason} ->
@@ -593,8 +596,10 @@ handler_init(Manager, ID, Peek, Sock) ->
RA = GSO(reuseaddr),
RP = GSO(reuseport),
OOBI = GSO(oobinline),
- SndBuf = GSO(sndbuf),
RcvBuf = GSO(rcvbuf),
+ RcvTO = GSO(rcvtimeo),
+ SndBuf = GSO(sndbuf),
+ SndTO = GSO(sndtimeo),
Linger = GSO(linger),
MTU = GIP(mtu),
MTUDisc = GIP(mtu_discover),
@@ -613,8 +618,10 @@ handler_init(Manager, ID, Peek, Sock) ->
"~n (socket) Reuse Port: ~s"
"~n (socket) Bind To Device: ~s"
"~n (socket) OOBInline: ~s"
- "~n (socket) SndBuf: ~s"
"~n (socket) RcvBuf: ~s"
+ "~n (socket) RcvTO: ~s"
+ "~n (socket) SndBuf: ~s"
+ "~n (socket) SndTO: ~s"
"~n (socket) Linger: ~s"
"~n (ip) MTU: ~s"
"~n (ip) MTU Discovery: ~s"
@@ -626,10 +633,12 @@ handler_init(Manager, ID, Peek, Sock) ->
"~n (ip) Recv TOS: ~s"
"~n (ip) Recv TTL: ~s",
[Domain, Type, Proto,
- RA, RP, B2D, OOBI, SndBuf, RcvBuf, Linger,
+ RA, RP, B2D, OOBI,
+ RcvBuf, RcvTO, SndBuf, SndTO,
+ Linger,
MTU, MTUDisc, MALL, MIF, MLoop, MTTL,
NF, RecvTOS, RecvTTL]),
- %% socket:setopt(Sock, otp, debug, true),
+
handler_loop(#handler{peek = Peek,
manager = Manager,
type = Type,