aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/gen_udp_SUITE.erl
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2018-06-21 11:00:25 +0200
committerLukas Larsson <[email protected]>2018-07-30 16:55:26 +0200
commita9d361b4be7d6329bedd7b37d454c1abf4f27233 (patch)
treea55a060d66bad33cff29fe00ab1ac1b171a4ce74 /lib/kernel/test/gen_udp_SUITE.erl
parent83445d0de88a1ad15066e6c415b2c2d9aa93d6a1 (diff)
downloadotp-a9d361b4be7d6329bedd7b37d454c1abf4f27233.tar.gz
otp-a9d361b4be7d6329bedd7b37d454c1abf4f27233.tar.bz2
otp-a9d361b4be7d6329bedd7b37d454c1abf4f27233.zip
erts: Limit the automatic max buffer for UDP to 2^16
There is no reason to have a larger buffer than this as the recvmsg call will never return more data. OTP-15206
Diffstat (limited to 'lib/kernel/test/gen_udp_SUITE.erl')
-rw-r--r--lib/kernel/test/gen_udp_SUITE.erl12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/kernel/test/gen_udp_SUITE.erl b/lib/kernel/test/gen_udp_SUITE.erl
index b39399b18a..3acfff929e 100644
--- a/lib/kernel/test/gen_udp_SUITE.erl
+++ b/lib/kernel/test/gen_udp_SUITE.erl
@@ -34,7 +34,7 @@
-export([init_per_testcase/2, end_per_testcase/2]).
-export([send_to_closed/1, active_n/1,
- buffer_size/1, binary_passive_recv/1, bad_address/1,
+ buffer_size/1, binary_passive_recv/1, max_buffer_size/1, bad_address/1,
read_packets/1, open_fd/1, connect/1, implicit_inet6/1,
local_basic/1, local_unbound/1,
local_fdopen/1, local_fdopen_unbound/1, local_abstract/1]).
@@ -44,7 +44,7 @@ suite() ->
{timetrap,{minutes,1}}].
all() ->
- [send_to_closed, buffer_size, binary_passive_recv,
+ [send_to_closed, buffer_size, binary_passive_recv, max_buffer_size,
bad_address, read_packets, open_fd, connect,
implicit_inet6, active_n,
{group, local}].
@@ -237,6 +237,14 @@ buffer_size_server_recv(Socket, IP, Port, Cnt) ->
end.
+%%-------------------------------------------------------------
+%% OTP-15206: Keep buffer small for udp
+%%-------------------------------------------------------------
+max_buffer_size(Config) when is_list(Config) ->
+ {ok, Socket} = gen_udp:open(0, [binary]),
+ ok = inet:setopts(Socket,[{recbuf, 1 bsl 20}]),
+ {ok, [{buffer, 65536}]} = inet:getopts(Socket,[buffer]),
+ gen_udp:close(Socket).
%%-------------------------------------------------------------
%% OTP-3823 gen_udp:recv does not return address in binary mode