aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2014-01-17 14:37:39 +0100
committerLukas Larsson <[email protected]>2014-01-27 15:25:27 +0100
commit8f8a03ba3556f2c2c70797bedf5d44b360659425 (patch)
treec0384560ea2e6e2b9a6d6d757e8a780ce8616490 /lib/kernel
parent25237481ccccd3ddfa74582dc267632ad618ba30 (diff)
downloadotp-8f8a03ba3556f2c2c70797bedf5d44b360659425.tar.gz
otp-8f8a03ba3556f2c2c70797bedf5d44b360659425.tar.bz2
otp-8f8a03ba3556f2c2c70797bedf5d44b360659425.zip
erts: fix bug when using passive mode and sendfile
The bug incorrectly issued driver_select when un-ignoring an fd for a socket in passive mode, which caused an incorrect error tuple to be returned when the remote end closed the connection.
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/test/sendfile_SUITE.erl20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/kernel/test/sendfile_SUITE.erl b/lib/kernel/test/sendfile_SUITE.erl
index 4cf4c6489d..24884bada5 100644
--- a/lib/kernel/test/sendfile_SUITE.erl
+++ b/lib/kernel/test/sendfile_SUITE.erl
@@ -33,6 +33,7 @@ all() ->
,t_sendfile_offset
,t_sendfile_sendafter
,t_sendfile_recvafter
+ ,t_sendfile_recvafter_remoteclose
,t_sendfile_sendduring
,t_sendfile_recvduring
,t_sendfile_closeduring
@@ -228,6 +229,25 @@ t_sendfile_recvafter(Config) ->
ok = sendfile_send(Send).
+%% This tests specifically for a bug fixed in 17.0
+t_sendfile_recvafter_remoteclose(Config) ->
+ Filename = proplists:get_value(small_file, Config),
+
+ Send = fun(Sock, SFServer) ->
+ {Size, _Data} = sendfile_file_info(Filename),
+ {ok, Size} = file:sendfile(Filename, Sock),
+
+ %% Make sure the remote end has been closed
+ SFServer ! stop,
+ timer:sleep(100),
+
+ %% In the bug this returned {error,ebadf}
+ {error,closed} = gen_tcp:recv(Sock, 1),
+ -1
+ end,
+
+ ok = sendfile_send({127,0,0,1},Send,0).
+
t_sendfile_sendduring(Config) ->
Filename = proplists:get_value(big_file, Config),