From 06c46662022efb6892c036eeaf8c957e51fc17f7 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 28 Nov 2018 20:31:37 +0100 Subject: erts: Fix unexpected inet_reply message from failing file:sendfile A failing file:sendfile call would often send a message {inet_reply, Port, {error, Reason}} that would pollute the mailbox of the calling process. TCP_REQ_SENDFILE has its own reply messages format {sendfile, _, _} and does not expect an inet_reply message. Solution: Suppress inet_reply error message if TCP_ADDF_SENDFILE is set. --- lib/kernel/test/sendfile_SUITE.erl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'lib/kernel') diff --git a/lib/kernel/test/sendfile_SUITE.erl b/lib/kernel/test/sendfile_SUITE.erl index 062209fa29..ad060aa05c 100644 --- a/lib/kernel/test/sendfile_SUITE.erl +++ b/lib/kernel/test/sendfile_SUITE.erl @@ -342,8 +342,20 @@ t_sendfile_closeduring(Config) -> end, ok = sendfile_send({127,0,0,1}, Send, 0, [{active,false}]), - ok = sendfile_send({127,0,0,1}, Send, 0, [{active,true}]). + [] = 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), -- cgit v1.2.3