aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2018-12-03 13:14:42 +0100
committerSverker Eriksson <[email protected]>2018-12-03 13:14:42 +0100
commit1dc8502e0c129358ba671708f0ad52ff36bb4027 (patch)
treef8f4ea1ab9d507eff4ba58f34a179f6ce4243995 /lib
parentec3126c0a6dddf3d735e60a4b723fbd86fc1eb2e (diff)
parent9ed2fb25bde3994be0daf67b47f80bf2f457c96d (diff)
downloadotp-1dc8502e0c129358ba671708f0ad52ff36bb4027.tar.gz
otp-1dc8502e0c129358ba671708f0ad52ff36bb4027.tar.bz2
otp-1dc8502e0c129358ba671708f0ad52ff36bb4027.zip
Merge branch 'sverker/erts/sendfile-error-bug/ERL-784/OTP-15461' into maint
* sverker/erts/sendfile-error-bug/ERL-784/OTP-15461: erts: Fix hanging sendfile bugs when socket closes unexpectedly erts: Fix unexpected inet_reply message from failing file:sendfile erts: Fix bug in sendfile for active socket
Diffstat (limited to 'lib')
-rw-r--r--lib/kernel/test/sendfile_SUITE.erl26
1 files changed, 22 insertions, 4 deletions
diff --git a/lib/kernel/test/sendfile_SUITE.erl b/lib/kernel/test/sendfile_SUITE.erl
index 0c0b1cbcb6..ad060aa05c 100644
--- a/lib/kernel/test/sendfile_SUITE.erl
+++ b/lib/kernel/test/sendfile_SUITE.erl
@@ -341,7 +341,21 @@ t_sendfile_closeduring(Config) ->
-1
end,
- ok = sendfile_send({127,0,0,1}, Send, 0).
+ ok = sendfile_send({127,0,0,1}, Send, 0, [{active,false}]),
+ [] = flush(),
+ ok = sendfile_send({127,0,0,1}, Send, 0, [{active,true}]),
+ [] = flush(),
+ ok.
+
+flush() ->
+ lists:reverse(flush([])).
+
+flush(Acc) ->
+ receive M ->
+ flush([M | Acc])
+ after 0 ->
+ Acc
+ end.
t_sendfile_crashduring(Config) ->
Filename = proplists:get_value(big_file, Config),
@@ -409,12 +423,16 @@ sendfile_send(Send) ->
sendfile_send(Host, Send) ->
sendfile_send(Host, Send, []).
sendfile_send(Host, Send, Orig) ->
+ sendfile_send(Host, Send, Orig, [{active,false}]).
+
+sendfile_send(Host, Send, Orig, SockOpts) ->
+
SFServer = spawn_link(?MODULE, sendfile_server, [self(), Orig]),
receive
{server, Port} ->
- {ok, Sock} = gen_tcp:connect(Host, Port,
- [binary,{packet,0},
- {active,false}]),
+ Opts = [binary,{packet,0}|SockOpts],
+ io:format("connect with opts = ~p\n", [Opts]),
+ {ok, Sock} = gen_tcp:connect(Host, Port, Opts),
Data = case proplists:get_value(arity,erlang:fun_info(Send)) of
1 ->
Send(Sock);