aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test
diff options
context:
space:
mode:
authorIgor Slepchin <[email protected]>2018-09-24 22:44:03 -0400
committerIgor Slepchin <[email protected]>2018-10-11 01:07:19 -0400
commit210665e8a252faecf28ccebade999e734ab92582 (patch)
tree8b81350cb43fd9a59ea13e34e03017f82fccbef3 /lib/kernel/test
parent3daef1a4ee8cfce90d0220be3695809ccbb8ea58 (diff)
downloadotp-210665e8a252faecf28ccebade999e734ab92582.tar.gz
otp-210665e8a252faecf28ccebade999e734ab92582.tar.bz2
otp-210665e8a252faecf28ccebade999e734ab92582.zip
Add nopush TCP socket option
This translates to TCP_CORK on Linux and TCP_NOPUSH on BSD. In effect, this acts as super-Nagle: no partial TCP segments are sent out until this option is turned off. Once turned off, all accumulated unsent data is sent out immediately. The latter is *not* the case on OSX, hence the implementation ignores "nopush" on OSX to reduce confusion.
Diffstat (limited to 'lib/kernel/test')
-rw-r--r--lib/kernel/test/inet_sockopt_SUITE.erl9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/kernel/test/inet_sockopt_SUITE.erl b/lib/kernel/test/inet_sockopt_SUITE.erl
index ada9c2689c..27ff74e309 100644
--- a/lib/kernel/test/inet_sockopt_SUITE.erl
+++ b/lib/kernel/test/inet_sockopt_SUITE.erl
@@ -110,9 +110,14 @@ simple(Config) when is_list(Config) ->
{S1,S2} = create_socketpair(Opt, Opt),
{ok,Opt} = inet:getopts(S1,OptTags),
{ok,Opt} = inet:getopts(S2,OptTags),
- COpt = [{X,case X of nodelay -> false;_ -> Y end} || {X,Y} <- Opt],
+ NoPushOpt = case os:type() of
+ {unix, Osname} when Osname =:= linux; Osname =:= freebsd -> {nopush, true};
+ {_,_} -> {nopush, false}
+ end,
+ COpt = [{X,case X of nodelay -> false;_ -> Y end} || {X,Y} <- [NoPushOpt|Opt]],
+ COptTags = [X || {X,_} <- COpt],
inet:setopts(S1,COpt),
- {ok,COpt} = inet:getopts(S1,OptTags),
+ {ok,COpt} = inet:getopts(S1,COptTags),
{ok,Opt} = inet:getopts(S2,OptTags),
gen_tcp:close(S1),
gen_tcp:close(S2),