0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Fix cancelling undefined settings timer

when settings_timeout is infinity
This commit is contained in:
Bing Han 2018-07-05 00:32:07 +08:00 committed by Loïc Hoguin
parent aee40d5bb5
commit e9fd2925ae
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
2 changed files with 21 additions and 1 deletions

View file

@ -159,3 +159,20 @@ resp_iolist_body(Config) ->
{ok, RespBody} = gun:await_body(ConnPid, Ref),
Len = iolist_size(RespBody),
gun:close(ConnPid).
settings_timeout_infinity(Config) ->
doc("Ensure infinity for settings_timeout is accepted."),
ProtoOpts = #{
env => #{dispatch => cowboy_router:compile(init_routes(Config))},
settings_timeout => infinity
},
{ok, Pid} = cowboy:start_clear(name(), [{port, 0}], ProtoOpts),
Ref = erlang:monitor(process, Pid),
Port = ranch:get_port(name()),
{ok, _} = do_handshake([{port, Port}|Config]),
receive
{'DOWN', Ref, process, Pid, Reason} ->
error(Reason)
after 1000 ->
cowboy:stop_listener(name())
end.