瀏覽代碼

fix issue#72

Ery Lee 11 年之前
父節點
當前提交
87e94f89c8
共有 2 個文件被更改,包括 3 次插入3 次删除
  1. 2 2
      apps/emqttd/src/emqttd_cm.erl
  2. 1 1
      apps/emqttd/src/emqttd_sm.erl

+ 2 - 2
apps/emqttd/src/emqttd_cm.erl

@@ -140,7 +140,7 @@ handle_call(_Request, _From, State) ->
 handle_cast({unregister, ClientId, Pid}, State) ->
 handle_cast({unregister, ClientId, Pid}, State) ->
 	case ets:lookup(?CLIENT_TAB, ClientId) of
 	case ets:lookup(?CLIENT_TAB, ClientId) of
 	[{_, Pid, MRef}] ->
 	[{_, Pid, MRef}] ->
-		erlang:demonitor(MRef),
+		erlang:demonitor(MRef, [flush]),
 		ets:delete(?CLIENT_TAB, ClientId);
 		ets:delete(?CLIENT_TAB, ClientId);
 	[_] -> 
 	[_] -> 
 		ignore;
 		ignore;
@@ -153,7 +153,7 @@ handle_cast(_Msg, State) ->
     {noreply, State}.
     {noreply, State}.
 
 
 handle_info({'DOWN', MRef, process, DownPid, _Reason}, 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)};
     {noreply, setstats(State)};
 
 
 handle_info(_Info, State) ->
 handle_info(_Info, State) ->

+ 1 - 1
apps/emqttd/src/emqttd_sm.erl

@@ -142,7 +142,7 @@ handle_cast(_Msg, State) ->
     {noreply, State}.
     {noreply, State}.
 
 
 handle_info({'DOWN', MRef, process, DownPid, _Reason}, 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)};
     {noreply, setstats(State)};
 
 
 handle_info(_Info, State) ->
 handle_info(_Info, State) ->