From ba9534a68399a9ad3285c1d9b1a8b4deae89c547 Mon Sep 17 00:00:00 2001 From: Feng Lee Date: Mon, 21 Sep 2015 21:11:42 +0800 Subject: [PATCH] fix issue #306 --- src/emqttd_protocol.erl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/emqttd_protocol.erl b/src/emqttd_protocol.erl index 6dbd85533..dcd120035 100644 --- a/src/emqttd_protocol.erl +++ b/src/emqttd_protocol.erl @@ -311,13 +311,14 @@ trace(send, Packet, #proto_state{peername = Peername, client_id = ClientId}) -> redeliver({?PUBREL, PacketId}, State) -> send(?PUBREL_PACKET(PacketId), State). -shutdown(duplicate_id, _State) -> - quiet; %% - shutdown(Error, #proto_state{client_id = undefined}) -> lager:info("Protocol shutdown ~p", [Error]), ignore; +shutdown(duplicate_id, #proto_state{client_id = ClientId}) -> + %% unregister the device + emqttd_cm:unregister(ClientId); + %% TODO: ClientId?? shutdown(Error, #proto_state{peername = Peername, client_id = ClientId, will_msg = WillMsg}) -> lager:info([{client, ClientId}], "Client ~s@~s: shutdown ~p",