From 87e94f89c8fe8641b9e2d05081b66a25554e2c42 Mon Sep 17 00:00:00 2001 From: Ery Lee Date: Thu, 19 Mar 2015 13:15:27 +0800 Subject: [PATCH] fix issue#72 --- apps/emqttd/src/emqttd_cm.erl | 4 ++-- apps/emqttd/src/emqttd_sm.erl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/emqttd/src/emqttd_cm.erl b/apps/emqttd/src/emqttd_cm.erl index c2f7cc079..90091ee14 100644 --- a/apps/emqttd/src/emqttd_cm.erl +++ b/apps/emqttd/src/emqttd_cm.erl @@ -140,7 +140,7 @@ handle_call(_Request, _From, State) -> handle_cast({unregister, ClientId, Pid}, State) -> case ets:lookup(?CLIENT_TAB, ClientId) of [{_, Pid, MRef}] -> - erlang:demonitor(MRef), + erlang:demonitor(MRef, [flush]), ets:delete(?CLIENT_TAB, ClientId); [_] -> ignore; @@ -153,7 +153,7 @@ handle_cast(_Msg, State) -> {noreply, State}. handle_info({'DOWN', MRef, process, DownPid, _Reason}, State) -> - ets:match_delete(?CLIENT_TAB, {{'_', DownPid, MRef}}), + ets:match_delete(?CLIENT_TAB, {'_', DownPid, MRef}), {noreply, setstats(State)}; handle_info(_Info, State) -> diff --git a/apps/emqttd/src/emqttd_sm.erl b/apps/emqttd/src/emqttd_sm.erl index 54194dcd6..319affcfc 100644 --- a/apps/emqttd/src/emqttd_sm.erl +++ b/apps/emqttd/src/emqttd_sm.erl @@ -142,7 +142,7 @@ handle_cast(_Msg, State) -> {noreply, State}. handle_info({'DOWN', MRef, process, DownPid, _Reason}, State) -> - ets:match_delete(?SESSION_TAB, {{'_', DownPid, MRef}}), + ets:match_delete(?SESSION_TAB, {'_', DownPid, MRef}), {noreply, setstats(State)}; handle_info(_Info, State) ->