aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-11-10 14:59:11 +0000
committerLoïc Hoguin <[email protected]>2017-11-10 14:59:11 +0000
commit6cc162583df2e476db6464a58c96318e3063bd19 (patch)
treeb3b7afee0b50069de01f75f013cc29b264ffbedf /src
parent32d9d494c70f1f48a9194fce8eb550cd3f88df54 (diff)
downloadcowboy-6cc162583df2e476db6464a58c96318e3063bd19.tar.gz
cowboy-6cc162583df2e476db6464a58c96318e3063bd19.tar.bz2
cowboy-6cc162583df2e476db6464a58c96318e3063bd19.zip
Keep the state returned by the tracer callback
It was mistakenly discarded.
Diffstat (limited to 'src')
-rw-r--r--src/cowboy_tracer_h.erl10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cowboy_tracer_h.erl b/src/cowboy_tracer_h.erl
index b69faf4..b527f7e 100644
--- a/src/cowboy_tracer_h.erl
+++ b/src/cowboy_tracer_h.erl
@@ -144,19 +144,19 @@ tracer_process(StreamID, Req=#{pid := Parent}, Opts=#{tracer_callback := Fun}) -
State = Fun(init, {StreamID, Req, Opts}),
tracer_loop(Parent, Fun, State).
-tracer_loop(Parent, Fun, State) ->
+tracer_loop(Parent, Fun, State0) ->
receive
Msg when element(1, Msg) =:= trace_ts ->
- Fun(Msg, State),
+ State = Fun(Msg, State0),
tracer_loop(Parent, Fun, State);
{'EXIT', Parent, Reason} ->
- tracer_terminate(Reason, Fun, State);
+ tracer_terminate(Reason, Fun, State0);
{system, From, Request} ->
- sys:handle_system_msg(Request, From, Parent, ?MODULE, [], {Fun, State});
+ sys:handle_system_msg(Request, From, Parent, ?MODULE, [], {Fun, State0});
Msg ->
error_logger:error_msg("~p: Tracer process received stray message ~9999p~n",
[?MODULE, Msg]),
- tracer_loop(Parent, Fun, State)
+ tracer_loop(Parent, Fun, State0)
end.
tracer_terminate(Reason, Fun, State) ->