From bf952738a3be59693c35b2983020196bbbf71538 Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin Date: Thu, 7 Mar 2019 16:13:19 +0100 Subject: ftp: New test case --- lib/ftp/test/ftp_SUITE.erl | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/lib/ftp/test/ftp_SUITE.erl b/lib/ftp/test/ftp_SUITE.erl index 81147b5821..0b070ee8cb 100644 --- a/lib/ftp/test/ftp_SUITE.erl +++ b/lib/ftp/test/ftp_SUITE.erl @@ -96,6 +96,7 @@ ftp_tests()-> recv_chunk, recv_chunk_twice, recv_chunk_three_times, + recv_chunk_delay, type, quote, error_elogin, @@ -732,21 +733,28 @@ recv_chunk(Pid, Acc) -> Error end. -%% Make new test case that uses this or new code -%% only test one thing at the time -%% delay_recv_chunk(Pid) -> -%% delay_recv_chunk(Pid, <<>>). -%% delay_recv_chunk(Pid, Acc) -> -%% ct:pal("FOO ~p", [byte_size(Acc)]), -%% case ftp:recv_chunk(Pid) of -%% ok -> -%% {ok, Acc}; -%% {ok, Bin} -> -%% ct:sleep(100), -%% delay_recv_chunk(Pid, <>); -%% Error -> -%% Error -%% end. +recv_chunk_delay(Config0) when is_list(Config0) -> + File1 = "big_file1.txt", + Contents = list_to_binary(lists:duplicate(1000, lists:seq(0,255))), + Config = set_state([reset, {mkfile,File1,Contents}], Config0), + Pid = proplists:get_value(ftp, Config), + ok = ftp:recv_chunk_start(Pid, id2ftp(File1,Config)), + {ok, ReceivedContents} = delay_recv_chunk(Pid), + find_diff(ReceivedContents, Contents). + +delay_recv_chunk(Pid) -> + delay_recv_chunk(Pid, <<>>). +delay_recv_chunk(Pid, Acc) -> + ct:pal("Recived size ~p", [byte_size(Acc)]), + case ftp:recv_chunk(Pid) of + ok -> + {ok, Acc}; + {ok, Bin} -> + ct:sleep(100), + delay_recv_chunk(Pid, <>); + Error -> + Error + end. %%------------------------------------------------------------------------- type() -> -- cgit v1.2.3 From ca46b31327072c88140e5434b29fa826fc3d47ad Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin Date: Thu, 7 Mar 2019 20:44:46 +0100 Subject: ssl: Correct active once emulation Conflicts: lib/ftp/test/ftp_SUITE.erl --- lib/ssl/src/ssl_connection.erl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/ssl/src/ssl_connection.erl b/lib/ssl/src/ssl_connection.erl index 24fb091ddf..ad81288f64 100644 --- a/lib/ssl/src/ssl_connection.erl +++ b/lib/ssl/src/ssl_connection.erl @@ -2691,6 +2691,11 @@ ssl_options_list([Key | Keys], [Value | Values], Acc) -> handle_active_option(false, connection = StateName, To, Reply, State) -> hibernate_after(StateName, State, [{reply, To, Reply}]); +handle_active_option(_, connection = StateName, To, _Reply, #state{connection_env = #connection_env{terminated = true}, + user_data_buffer = {_,0,_}} = State) -> + handle_normal_shutdown(?ALERT_REC(?FATAL, ?CLOSE_NOTIFY, all_data_deliverd), StateName, + State#state{start_or_recv_from = To}), + {stop,{shutdown, peer_close}, State}; handle_active_option(_, connection = StateName0, To, Reply, #state{static_env = #static_env{protocol_cb = Connection}, user_data_buffer = {_,0,_}} = State0) -> case Connection:next_event(StateName0, no_record, State0) of -- cgit v1.2.3