diff options
author | Loïc Hoguin <[email protected]> | 2014-03-08 19:51:39 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-03-08 19:51:39 +0100 |
commit | 8993249e421fbfff603cedec70e90be64d3694e6 (patch) | |
tree | cfa987ebb93e1d77792640d6bf74d1e6b18e9ccc /src/cowboy_websocket.erl | |
parent | 239e5e0ba7f413642aca3cf2735f0709a643fb8e (diff) | |
download | cowboy-8993249e421fbfff603cedec70e90be64d3694e6.tar.gz cowboy-8993249e421fbfff603cedec70e90be64d3694e6.tar.bz2 cowboy-8993249e421fbfff603cedec70e90be64d3694e6.zip |
Fix typespecs of cowboy_websocket:handler_terminate
Pointed out during the ConcuError tutorial by Kostis. Thanks! :-)
Diffstat (limited to 'src/cowboy_websocket.erl')
-rw-r--r-- | src/cowboy_websocket.erl | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cowboy_websocket.erl b/src/cowboy_websocket.erl index 6220a74..528e146 100644 --- a/src/cowboy_websocket.erl +++ b/src/cowboy_websocket.erl @@ -42,6 +42,8 @@ -type frag_state() :: undefined | {nofin, opcode(), binary()} | {fin, opcode(), binary()}. -type rsv() :: << _:3 >>. +-type terminate_reason() :: {normal | error | remote, atom()} + | {remote, close_code(), binary()}. -record(state, { env :: cowboy_middleware:env(), @@ -730,8 +732,7 @@ websocket_send_many([Frame|Tail], State) -> {Error, State2} -> {Error, State2} end. --spec websocket_close(#state{}, Req, any(), - {atom(), atom()} | {remote, close_code(), binary()}) +-spec websocket_close(#state{}, Req, any(), terminate_reason()) -> {ok, Req, cowboy_middleware:env()} when Req::cowboy_req:req(). websocket_close(State=#state{socket=Socket, transport=Transport}, @@ -752,7 +753,7 @@ websocket_close(State=#state{socket=Socket, transport=Transport}, end, 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()} when Req::cowboy_req:req(). handler_terminate(#state{env=Env, handler=Handler}, |