diff options
Diffstat (limited to 'src/cowboy_http_handler.erl')
-rw-r--r-- | src/cowboy_http_handler.erl | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/cowboy_http_handler.erl b/src/cowboy_http_handler.erl index d686f30..0393153 100644 --- a/src/cowboy_http_handler.erl +++ b/src/cowboy_http_handler.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2011-2012, Loïc Hoguin <[email protected]> +%% Copyright (c) 2011-2013, Loïc Hoguin <[email protected]> %% %% Permission to use, copy, modify, and/or distribute this software for any %% purpose with or without fee is hereby granted, provided that the above @@ -22,8 +22,8 @@ %% <em>handle/2</em> allows you to handle the request. It receives the %% state previously defined. %% -%% <em>terminate/2</em> allows you to clean up. It receives the state -%% previously defined. +%% <em>terminate/3</em> allows you to clean up. It receives the +%% termination reason and the state previously defined. %% %% There is no required operation to perform in any of these callbacks %% other than returning the proper values. Make sure you always return @@ -33,6 +33,9 @@ -type opts() :: any(). -type state() :: any(). +-type terminate_reason() :: {normal, shutdown} + | {normal, timeout} %% Only occurs in loop handlers. + | {error, atom()}. -callback init({atom(), http}, Req, opts()) -> {ok, Req, state()} @@ -42,7 +45,8 @@ | {loop, Req, state(), timeout(), hibernate} | {shutdown, Req, state()} | {upgrade, protocol, module()} + | {upgrade, protocol, module(), Req, opts()} when Req::cowboy_req:req(). -callback handle(Req, State) -> {ok, Req, State} when Req::cowboy_req:req(), State::state(). --callback terminate(cowboy_req:req(), state()) -> ok. +-callback terminate(terminate_reason(), cowboy_req:req(), state()) -> ok. |