diff --git a/src/quicer.erl b/src/quicer.erl index e161450e..e3966feb 100644 --- a/src/quicer.erl +++ b/src/quicer.erl @@ -1285,7 +1285,7 @@ stats_map(_) -> undefined. default_stream_opts() -> - #{active => true}. + #{active => true, start_flag => ?QUIC_STREAM_START_FLAG_SHUTDOWN_ON_FAIL}. default_conn_opts() -> #{ diff --git a/test/prop_stateful_client_conn.erl b/test/prop_stateful_client_conn.erl index d816f715..a3dbca0e 100644 --- a/test/prop_stateful_client_conn.erl +++ b/test/prop_stateful_client_conn.erl @@ -191,11 +191,11 @@ postcondition( ) -> Owner =/= self(); postcondition( - #{owner := Owner, state := connected}, - {call, quicer, controlling_process, [_, _]}, + #{owner := _, state := connected}, + {call, quicer, controlling_process, [_, NewOwner]}, {error, owner_dead} ) -> - Owner =/= self(); + NewOwner =/= self(); %% postcondition(#{owner := Owner, state := closed} = State, {call, quicer, controlling_process, [_, _]}, {error, not_owner}) -> %% true; postcondition(#{handle := H, state := connected}, {call, quicer, get_connections, _}, Conns) -> diff --git a/test/prop_stateful_server_conn.erl b/test/prop_stateful_server_conn.erl index 94fc3b8c..c1ce4a0e 100644 --- a/test/prop_stateful_server_conn.erl +++ b/test/prop_stateful_server_conn.erl @@ -36,25 +36,27 @@ prop_server_state_test(opts) -> [{numtests, 2000}]. prop_server_state_test() -> - %% dbg:tracer(process, {fun dbg:dhandler/2,group_leader()}), - %% dbg:p(self(), c), - %% dbg:tp(quicer, cx), process_flag(trap_exit, true), - {ok, L} = quicer:listen(?PORT, default_listen_opts()), - put(listener, L), - ?FORALL( - Cmds, - commands(?MODULE), - begin - {History, State, Result} = run_commands(?MODULE, Cmds), - ?WHENFAIL( - io:format( - "History: ~p\nState: ~p\nResult: ~p\n", - [History, State, Result] - ), - aggregate(command_names(Cmds), Result =:= ok) - ) - end + ?SETUP( + fun() -> + {ok, L} = quicer:listen(?PORT, default_listen_opts()), + put(listener, L), + fun() -> quicer:close_listener(L) end + end, + ?FORALL( + Cmds, + commands(?MODULE), + begin + {History, State, Result} = run_commands(?MODULE, Cmds), + ?WHENFAIL( + io:format( + "History: ~p\nState: ~p\nResult: ~p\n", + [History, State, Result] + ), + aggregate(command_names(Cmds), Result =:= ok) + ) + end + ) ). %%%%%%%%%%%%% @@ -63,7 +65,7 @@ prop_server_state_test() -> %% @doc Initial model value at system start. Should be deterministic. initial_state() -> process_flag(trap_exit, true), - {ok, L} = quicer:async_accept(get(listener), #{active => false}), + {ok, _L} = quicer:async_accept(get(listener), #{active => false}), %%% We don't care about the client thus no linking. spawn(fun() -> @@ -265,7 +267,7 @@ postcondition( is_pid(NewOwner); %% postcondition(#{owner := Owner, state := closed} = State, {call, quicer, controlling_process, [_, _]}, {error, not_owner}) -> %% true; -postcondition(#{handle := H, state := S}, {call, quicer, get_connections, _}, Conns) when +postcondition(#{handle := _H, state := _S}, {call, quicer, get_connections, _}, Conns) when is_list(Conns) -> %% @TODO check why handle is not member diff --git a/test/prop_stateful_stream.erl b/test/prop_stateful_stream.erl index 7aa2f583..1e7021ff 100644 --- a/test/prop_stateful_stream.erl +++ b/test/prop_stateful_stream.erl @@ -42,7 +42,7 @@ prop_stateful_client_stream_test() -> commands(?MODULE), begin flush_quic_msgs(), - {ok, H} = quicer:connect("localhost", 14569, default_conn_opts(), 10000), + {ok, H} = quicer:connect("localhost", 14571, default_conn_opts(), 10000), {History, State, Result} = run_commands(?MODULE, Cmds, [{conn_handle, H}]), quicer:async_shutdown_connection(H, ?QUIC_CONNECTION_SHUTDOWN_FLAG_SILENT, 0), ?WHENFAIL( @@ -272,7 +272,7 @@ flush_quic_msgs() -> %%%%%%%%%%%%%%%%%%%%%%% listener_start_link(ListenerName) -> application:ensure_all_started(quicer), - LPort = 14569, + LPort = 14571, ListenerOpts = default_listen_opts(), ConnectionOpts = [ {conn_callback, example_server_connection}, diff --git a/test/quicer_SUITE.erl b/test/quicer_SUITE.erl index a11e45c9..e16f613f 100644 --- a/test/quicer_SUITE.erl +++ b/test/quicer_SUITE.erl @@ -1927,7 +1927,7 @@ tc_stream_open_flag_unidirectional(Config) -> receive {quic, <<"ping1">>, Stm, _} -> ct:fail("unidirectional stream should not receive any"); - {quic, stream_closed, Stm, #{is_conn_shutdown := true, is_app_closing := false}} -> + {quic, stream_closed, Stm, #{is_conn_shutdown := _, is_app_closing := false}} -> ct:pal("stream is closed due to connecion idle") end, ?assert(is_integer(Rid)),