From 5c46004c184af9a9e9b4f4cc5916a80833607a11 Mon Sep 17 00:00:00 2001 From: Feng Date: Thu, 16 Jul 2015 15:55:58 +0800 Subject: [PATCH] hooks --- src/emqttd_protocol.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/emqttd_protocol.erl b/src/emqttd_protocol.erl index 40fad61b0..b6eb96cf3 100644 --- a/src/emqttd_protocol.erl +++ b/src/emqttd_protocol.erl @@ -312,8 +312,8 @@ shutdown(Error, #proto_state{peername = Peername, client_id = ClientId, will_msg lager:info([{client, ClientId}], "Client ~s@~s: shutdown ~p", [ClientId, emqttd_net:format(Peername), Error]), send_willmsg(ClientId, WillMsg), - emqttd_cm:unregister(ClientId), - emqttd_broker:foreach_hooks('client.disconnected', [Error, ClientId]). + emqttd_broker:foreach_hooks('client.disconnected', [Error, ClientId]), + emqttd_cm:unregister(ClientId). willmsg(Packet) when is_record(Packet, mqtt_packet_connect) -> emqttd_message:from_packet(Packet).