0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 12:40:25 +00:00

Handle supervisor calls properly everywhere

This commit is contained in:
Loïc Hoguin 2018-03-13 10:40:14 +01:00
parent a89732e8e0
commit b9c8d86502
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
5 changed files with 35 additions and 47 deletions

View file

@ -250,6 +250,10 @@ handler_loop(State=#state{socket=Socket, messages={OK, Closed, Error},
websocket_close(State, HandlerState, timeout);
{timeout, OlderTRef, ?MODULE} when is_reference(OlderTRef) ->
handler_loop(State, HandlerState, SoFar);
%% Calls from supervisor module.
{'$gen_call', From, Call} ->
cowboy_children:handle_supervisor_call(Call, From, [], ?MODULE),
handler_loop(State, HandlerState, SoFar);
Message ->
handler_call(State, HandlerState,
SoFar, websocket_info, Message, fun handler_before_loop/3)