diff options
author | Loïc Hoguin <[email protected]> | 2016-06-13 16:00:17 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2016-06-13 16:00:17 +0200 |
commit | b82bb92f7e6cf751ec74fc8aec0bfea84bfc5415 (patch) | |
tree | 5a77cc01846d9c342bf3a6e8098bb401591f178d /src/cowboy_tls.erl | |
parent | 88227898edd26a823d0942fc7226adb61a20cb5d (diff) | |
download | cowboy-b82bb92f7e6cf751ec74fc8aec0bfea84bfc5415.tar.gz cowboy-b82bb92f7e6cf751ec74fc8aec0bfea84bfc5415.tar.bz2 cowboy-b82bb92f7e6cf751ec74fc8aec0bfea84bfc5415.zip |
Fix streaming HTTP/2 responses
Error reporting for connection processes has been improved,
using a similar proc_lib hack as was done for the stream
processes.
Diffstat (limited to 'src/cowboy_tls.erl')
-rw-r--r-- | src/cowboy_tls.erl | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/cowboy_tls.erl b/src/cowboy_tls.erl index 375b005..c9999e3 100644 --- a/src/cowboy_tls.erl +++ b/src/cowboy_tls.erl @@ -16,13 +16,24 @@ -behavior(ranch_protocol). -export([start_link/4]). --export([init/5]). +-export([proc_lib_hack/5]). -spec start_link(ranch:ref(), inet:socket(), module(), cowboy:opts()) -> {ok, pid()}. start_link(Ref, Socket, Transport, Opts) -> - Pid = proc_lib:spawn_link(?MODULE, init, [self(), Ref, Socket, Transport, Opts]), + Pid = proc_lib:spawn_link(?MODULE, proc_lib_hack, [self(), Ref, Socket, Transport, Opts]), {ok, Pid}. +-spec proc_lib_hack(pid(), ranch:ref(), inet:socket(), module(), cowboy:opts()) -> ok. +proc_lib_hack(Parent, Ref, Socket, Transport, Opts) -> + try + init(Parent, Ref, Socket, Transport, Opts) + catch + _:normal -> exit(normal); + _:shutdown -> exit(shutdown); + _:Reason = {shutdown, _} -> exit(Reason); + _:Reason -> exit({Reason, erlang:get_stacktrace()}) + end. + -spec init(pid(), ranch:ref(), inet:socket(), module(), cowboy:opts()) -> ok. init(Parent, Ref, Socket, Transport, Opts) -> ok = ranch:accept_ack(Ref), |