summaryrefslogtreecommitdiff
path: root/deps/rabbitmq_web_stomp
diff options
context:
space:
mode:
authorLuke Bakken <lbakken@pivotal.io>2020-06-12 08:11:41 -0700
committerLuke Bakken <lbakken@pivotal.io>2020-06-12 08:11:41 -0700
commit43c91d3c0958d4e398f6ed4a88c69c1de3c87a52 (patch)
tree091c28f457adc6c95198ba30fd03a2c7c09720cc /deps/rabbitmq_web_stomp
parent262698fa3a5bf589cebb92ad6b0017138485e216 (diff)
downloadrabbitmq-server-git-43c91d3c0958d4e398f6ed4a88c69c1de3c87a52.tar.gz
Use correct close code and provide error information
Diffstat (limited to 'deps/rabbitmq_web_stomp')
-rw-r--r--deps/rabbitmq_web_stomp/src/rabbit_web_stomp_handler.erl12
1 files changed, 8 insertions, 4 deletions
diff --git a/deps/rabbitmq_web_stomp/src/rabbit_web_stomp_handler.erl b/deps/rabbitmq_web_stomp/src/rabbit_web_stomp_handler.erl
index 41af9bc5b3..1657aed877 100644
--- a/deps/rabbitmq_web_stomp/src/rabbit_web_stomp_handler.erl
+++ b/deps/rabbitmq_web_stomp/src/rabbit_web_stomp_handler.erl
@@ -234,8 +234,9 @@ handle_data(Data, State0) ->
case handle_data1(Data, State0) of
{ok, State1 = #state{state = blocked}} ->
{[{active, false}], State1};
- {error, _} ->
- {stop, State0};
+ {error, Error0} ->
+ Error1 = rabbit_misc:format("~p", [Error0]),
+ stop(State0, 1007, Error1);
Other ->
Other
end.
@@ -271,11 +272,14 @@ maybe_block(State = #state{state = blocking, heartbeat = Heartbeat},
maybe_block(State, _) ->
State.
-stop(State = #state{proc_state = ProcState}) ->
+stop(State) ->
+ stop(State, 1000, "STOMP died").
+
+stop(State = #state{proc_state = ProcState}, CloseCode, Error) ->
maybe_emit_stats(State),
ok = file_handle_cache:release(),
rabbit_stomp_processor:flush_and_die(ProcState),
- {reply, {close, 1000, "STOMP died"}, State}.
+ {reply, {close, CloseCode, Error}, State}.
%%----------------------------------------------------------------------------