Parcourir la source

Remove the 'DOWN' client from emqttd_stats

Feng Lee il y a 9 ans
Parent
commit
6b22fb0a0c
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      src/emqttd_cm.erl

+ 5 - 1
src/emqttd_cm.erl

@@ -1,5 +1,5 @@
 %%--------------------------------------------------------------------
 %%--------------------------------------------------------------------
-%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>.
+%% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io)
 %%
 %%
 %% Licensed under the Apache License, Version 2.0 (the "License");
 %% Licensed under the Apache License, Version 2.0 (the "License");
 %% you may not use this file except in compliance with the License.
 %% you may not use this file except in compliance with the License.
@@ -15,10 +15,13 @@
 %%--------------------------------------------------------------------
 %%--------------------------------------------------------------------
 
 
 %% @doc MQTT Client Manager
 %% @doc MQTT Client Manager
+
 -module(emqttd_cm).
 -module(emqttd_cm).
 
 
 -behaviour(gen_server2).
 -behaviour(gen_server2).
 
 
+-author("Feng Lee <feng@emqtt.io>").
+
 -include("emqttd.hrl").
 -include("emqttd.hrl").
 
 
 -include("emqttd_internal.hrl").
 -include("emqttd_internal.hrl").
@@ -120,6 +123,7 @@ handle_info({'DOWN', MRef, process, DownPid, _Reason}, State) ->
         {ok, {ClientId, DownPid}} ->
         {ok, {ClientId, DownPid}} ->
             case lookup_proc(ClientId) of
             case lookup_proc(ClientId) of
                 DownPid ->
                 DownPid ->
+                    emqttd_stats:del_client_stats(ClientId),
                     ets:delete(mqtt_client, ClientId);
                     ets:delete(mqtt_client, ClientId);
                 _ ->
                 _ ->
                     ignore
                     ignore