aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_spdy.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2013-08-24 11:20:14 +0200
committerLoïc Hoguin <[email protected]>2013-08-24 20:21:05 +0200
commitbfb6db1eabb945777627a7ced8ab7f1dbc29af67 (patch)
tree6b288eb0ee65580e108fc440eaaf639ec37025a7 /src/cowboy_spdy.erl
parentac6c460169436a0f022983f3a614ac7ca3e313cd (diff)
downloadcowboy-bfb6db1eabb945777627a7ced8ab7f1dbc29af67.tar.gz
cowboy-bfb6db1eabb945777627a7ced8ab7f1dbc29af67.tar.bz2
cowboy-bfb6db1eabb945777627a7ced8ab7f1dbc29af67.zip
Simpler code for sending errors following crashes
Diffstat (limited to 'src/cowboy_spdy.erl')
-rw-r--r--src/cowboy_spdy.erl18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/cowboy_spdy.erl b/src/cowboy_spdy.erl
index 182e6da..cc4d867 100644
--- a/src/cowboy_spdy.erl
+++ b/src/cowboy_spdy.erl
@@ -520,8 +520,8 @@ execute(Req, Env, [Middleware|Tail]) ->
[Env, Tail, Module, Function, Args]);
{halt, Req2} ->
cowboy_req:ensure_response(Req2, 204);
- {error, Code, Req2} ->
- error_terminate(Code, Req2)
+ {error, Status, Req2} ->
+ cowboy_req:maybe_reply(Status, Req2)
end.
%% @private
@@ -536,18 +536,8 @@ resume(Env, Tail, Module, Function, Args) ->
[Env, Tail, Module2, Function2, Args2]);
{halt, Req2} ->
cowboy_req:ensure_response(Req2, 204);
- {error, Code, Req2} ->
- error_terminate(Code, Req2)
- end.
-
-%% Only send an error reply if there is no resp_sent message.
--spec error_terminate(cowboy:http_status(), cowboy_req:req()) -> ok.
-error_terminate(Code, Req) ->
- receive
- {cowboy_req, resp_sent} -> ok
- after 0 ->
- _ = cowboy_req:reply(Code, Req),
- ok
+ {error, Status, Req2} ->
+ cowboy_req:maybe_reply(Status, Req2)
end.
%% Reply functions used by cowboy_req.