Auth failure not publish the will message

This commit is contained in:
turtled 2017-10-09 18:07:09 +08:00
parent d9f14dacaf
commit 88c77cf4c2
1 changed files with 5 additions and 1 deletions

View File

@ -387,7 +387,11 @@ shutdown(conflict, #proto_state{client_id = _ClientId}) ->
shutdown(Error, State = #proto_state{will_msg = WillMsg}) -> shutdown(Error, State = #proto_state{will_msg = WillMsg}) ->
?LOG(debug, "Shutdown for ~p", [Error], State), ?LOG(debug, "Shutdown for ~p", [Error], State),
Client = client(State), Client = client(State),
send_willmsg(Client, WillMsg), %% Auth failure not publish the will message
case Error =:= auth_failure of
true -> ok;
false -> send_willmsg(Client, WillMsg)
end,
emqttd_hooks:run('client.disconnected', [Error], Client), emqttd_hooks:run('client.disconnected', [Error], Client),
%% let it down %% let it down
%% emqttd_cm:unreg(ClientId). %% emqttd_cm:unreg(ClientId).