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

Don't log stray messages for lingering HTTP/2 streams

This commit is contained in:
Loïc Hoguin 2019-10-10 17:06:24 +02:00
parent 525eeeecc9
commit 3ae228897a
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764

View file

@ -572,7 +572,7 @@ down(State=#state{opts=Opts, children=Children0}, Pid, Msg) ->
State State
end. end.
info(State=#state{opts=Opts, streams=Streams}, StreamID, Msg) -> info(State=#state{opts=Opts, http2_machine=HTTP2Machine, streams=Streams}, StreamID, Msg) ->
case Streams of case Streams of
#{StreamID := Stream=#stream{state=StreamState0}} -> #{StreamID := Stream=#stream{state=StreamState0}} ->
try cowboy_stream:info(StreamID, Msg, StreamState0) of try cowboy_stream:info(StreamID, Msg, StreamState0) of
@ -587,8 +587,13 @@ info(State=#state{opts=Opts, streams=Streams}, StreamID, Msg) ->
'Unhandled exception in cowboy_stream:info/3.'}) 'Unhandled exception in cowboy_stream:info/3.'})
end; end;
_ -> _ ->
cowboy:log(warning, "Received message ~p for unknown or terminated stream ~p.", case cow_http2_machine:is_lingering_stream(StreamID, HTTP2Machine) of
[Msg, StreamID], Opts), true ->
ok;
false ->
cowboy:log(warning, "Received message ~p for unknown stream ~p.",
[Msg, StreamID], Opts)
end,
State State
end. end.