diff options
author | Micael Karlberg <[email protected]> | 2018-05-08 12:36:35 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2018-09-18 13:01:37 +0200 |
commit | d6b051d9b09aeba00d1bbd0d448dde6e551c4442 (patch) | |
tree | f550f2dfe8a5689f8503ee05494c7c742948d048 /erts/preloaded | |
parent | fece5e536ba4e814bcfe5896e23c2ef979468c7b (diff) | |
download | otp-d6b051d9b09aeba00d1bbd0d448dde6e551c4442.tar.gz otp-d6b051d9b09aeba00d1bbd0d448dde6e551c4442.tar.bz2 otp-d6b051d9b09aeba00d1bbd0d448dde6e551c4442.zip |
[socket-nif] More setopt - udp
Add setopt for one udp option: cork. This is not
platform independent. Aas fas as I know, it only works
on linux, so for now this serves as a placeholder.
Diffstat (limited to 'erts/preloaded')
-rw-r--r-- | erts/preloaded/src/socket.erl | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl index 1c811fa11a..4a9de0dc9e 100644 --- a/erts/preloaded/src/socket.erl +++ b/erts/preloaded/src/socket.erl @@ -270,9 +270,8 @@ maxseg | nodelay. --type udp_socket_option() :: checksum | - maxdgram | - recvspace. +-type udp_socket_option() :: cork. + -type sctp_socket_option() :: adaption_layer | associnfo | @@ -444,6 +443,8 @@ -define(SOCKET_OPT_TCP_MAXSEG, 1). -define(SOCKET_OPT_TCP_NODELAY, 2). +-define(SOCKET_OPT_UDP_CORK, 1). + -define(SOCKET_OPT_SCTP_AUTOCLOSE, 7). -define(SOCKET_OPT_SCTP_NODELAY, 22). @@ -1638,7 +1639,7 @@ enc_setopt_value(ipv6, hoplimit, V, _D, T, _P) enc_setopt_value(ipv6 = L, Opt, V, _D, _T, _P) -> not_supported({L, Opt, V}); -enc_setopt_value(tcp, congetsion, V, _D, T, P) +enc_setopt_value(tcp, congestion, V, _D, T, P) when is_list(V) andalso (T =:= stream) andalso (P =:= tcp) -> @@ -1656,6 +1657,11 @@ enc_setopt_value(tcp, nodelay, V, _D, T, P) enc_setopt_value(tcp = L, Opt, V, _D, _T, _P) -> not_supported({L, Opt, V}); +enc_setopt_value(udp, cork, V, _D, T, P) + when is_boolean(V) andalso + (T =:= dgram) andalso + (P =:= udp) -> + V; enc_setopt_value(udp = L, Opt, _V, _D, _T, _P) -> not_supported({L, Opt}); @@ -1940,6 +1946,8 @@ enc_sockopt_key(tcp, UnknownOpt, _Dir, _D, _T, _P) -> unknown(UnknownOpt); %% UDP socket options +enc_sockopt_key(udp, cork = _Opt, _Dir, _D, _T, _P) -> + ?SOCKET_OPT_UDP_CORK; enc_sockopt_key(udp, UnknownOpt, _Dir, _D, _T, _P) -> unknown(UnknownOpt); |