From c602871f86c795da8463908d12f7bf966bfeec12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 20 Oct 2017 13:16:04 +0100 Subject: Fix HTTP/1.1 stopping streams too early It is possible in some cases to move on to the next request without waiting, but that can be done as an optimization later on if necessary. --- test/handlers/stream_handler_h.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'test/handlers/stream_handler_h.erl') diff --git a/test/handlers/stream_handler_h.erl b/test/handlers/stream_handler_h.erl index 74fc478..23d6b15 100644 --- a/test/handlers/stream_handler_h.erl +++ b/test/handlers/stream_handler_h.erl @@ -43,6 +43,8 @@ init_commands(_, _, State=#state{test=shutdown_timeout_on_stream_stop}) -> init_commands(_, _, State=#state{test=shutdown_timeout_on_socket_close}) -> Spawn = init_process(true, State), [{headers, 200, #{}}, {spawn, Spawn, 2000}]; +init_commands(_, _, State=#state{test=terminate_on_stop}) -> + [{response, 204, #{}, <<>>}]; init_commands(_, _, _) -> [{headers, 200, #{}}]. @@ -72,7 +74,10 @@ info(_, crash, #state{test=crash_in_info}) -> error(crash); info(StreamID, Info, State=#state{pid=Pid}) -> Pid ! {Pid, self(), info, StreamID, Info, State}, - {[], State}. + case Info of + please_stop -> {[stop], State}; + _ -> {[], State} + end. terminate(StreamID, Reason, State=#state{pid=Pid, test=crash_in_terminate}) -> Pid ! {Pid, self(), terminate, StreamID, Reason, State}, -- cgit v1.2.3