Skip to content

Commit 494c1b8

Browse files
committed
mqtt: handle connection shutdown
`{shutdown, Reason}` must be handled into handle_call and not handle_info `rabbitmqctl close_all_user_connections` calls rabbit_reader which does a call into the process, the same as rabbitmq_management
1 parent b819638 commit 494c1b8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

deps/rabbitmq_mqtt/src/rabbit_mqtt_reader.erl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ init(Ref) ->
109109
handle_call({info, InfoItems}, _From, State) ->
110110
{reply, infos(InfoItems, State), State, ?HIBERNATE_AFTER};
111111

112+
handle_call({shutdown, Explanation} = Reason, _From, State = #state{conn_name = ConnName}) ->
113+
%% rabbit_networking:close_all_user_connections -> rabbit_reader:shutdow
114+
?LOG_INFO("MQTT closing connection ~tp: ~p", [ConnName, Explanation]),
115+
{stop, Reason, ok, State};
116+
112117
handle_call(Msg, From, State) ->
113118
{stop, {mqtt_unexpected_call, Msg, From}, State}.
114119

0 commit comments

Comments
 (0)