mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
Fix typespecs of cowboy_websocket:handler_terminate
Pointed out during the ConcuError tutorial by Kostis. Thanks! :-)
This commit is contained in:
parent
239e5e0ba7
commit
8993249e42
1 changed files with 4 additions and 3 deletions
|
@ -42,6 +42,8 @@
|
||||||
-type frag_state() :: undefined
|
-type frag_state() :: undefined
|
||||||
| {nofin, opcode(), binary()} | {fin, opcode(), binary()}.
|
| {nofin, opcode(), binary()} | {fin, opcode(), binary()}.
|
||||||
-type rsv() :: << _:3 >>.
|
-type rsv() :: << _:3 >>.
|
||||||
|
-type terminate_reason() :: {normal | error | remote, atom()}
|
||||||
|
| {remote, close_code(), binary()}.
|
||||||
|
|
||||||
-record(state, {
|
-record(state, {
|
||||||
env :: cowboy_middleware:env(),
|
env :: cowboy_middleware:env(),
|
||||||
|
@ -730,8 +732,7 @@ websocket_send_many([Frame|Tail], State) ->
|
||||||
{Error, State2} -> {Error, State2}
|
{Error, State2} -> {Error, State2}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec websocket_close(#state{}, Req, any(),
|
-spec websocket_close(#state{}, Req, any(), terminate_reason())
|
||||||
{atom(), atom()} | {remote, close_code(), binary()})
|
|
||||||
-> {ok, Req, cowboy_middleware:env()}
|
-> {ok, Req, cowboy_middleware:env()}
|
||||||
when Req::cowboy_req:req().
|
when Req::cowboy_req:req().
|
||||||
websocket_close(State=#state{socket=Socket, transport=Transport},
|
websocket_close(State=#state{socket=Socket, transport=Transport},
|
||||||
|
@ -752,7 +753,7 @@ websocket_close(State=#state{socket=Socket, transport=Transport},
|
||||||
end,
|
end,
|
||||||
handler_terminate(State, Req, HandlerState, Reason).
|
handler_terminate(State, Req, HandlerState, Reason).
|
||||||
|
|
||||||
-spec handler_terminate(#state{}, Req, any(), atom() | {atom(), atom()})
|
-spec handler_terminate(#state{}, Req, any(), terminate_reason())
|
||||||
-> {ok, Req, cowboy_middleware:env()}
|
-> {ok, Req, cowboy_middleware:env()}
|
||||||
when Req::cowboy_req:req().
|
when Req::cowboy_req:req().
|
||||||
handler_terminate(#state{env=Env, handler=Handler},
|
handler_terminate(#state{env=Env, handler=Handler},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue