From 4559b5023e4960995b5384ef192d05c4ef9fbd57 Mon Sep 17 00:00:00 2001 From: terry-xiaoyu <506895667@qq.com> Date: Sat, 20 Jul 2019 16:20:53 +0800 Subject: [PATCH 1/3] Fix heartbeat interval --- src/emqx_sys.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/emqx_sys.erl b/src/emqx_sys.erl index 51d0d8cb94..8a9374e2dd 100644 --- a/src/emqx_sys.erl +++ b/src/emqx_sys.erl @@ -96,7 +96,7 @@ sys_interval() -> %% @doc Get sys heatbeat interval -spec(sys_heatbeat_interval() -> pos_integer()). sys_heatbeat_interval() -> - application:get_env(?APP, sys_heartbeat, 30000). + application:get_env(?APP, broker_sys_heartbeat, 30000). %% @doc Get sys info -spec(info() -> list(tuple())). From fa7292560a70003e22393e6a69c572096b9a8fbc Mon Sep 17 00:00:00 2001 From: terry-xiaoyu <506895667@qq.com> Date: Sat, 20 Jul 2019 16:20:53 +0800 Subject: [PATCH 2/3] Fix heartbeat interval --- src/emqx_sys.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/emqx_sys.erl b/src/emqx_sys.erl index 51d0d8cb94..8a9374e2dd 100644 --- a/src/emqx_sys.erl +++ b/src/emqx_sys.erl @@ -96,7 +96,7 @@ sys_interval() -> %% @doc Get sys heatbeat interval -spec(sys_heatbeat_interval() -> pos_integer()). sys_heatbeat_interval() -> - application:get_env(?APP, sys_heartbeat, 30000). + application:get_env(?APP, broker_sys_heartbeat, 30000). %% @doc Get sys info -spec(info() -> list(tuple())). From 0569388f0f81f52fcff92d23a72dc019a60f3e5f Mon Sep 17 00:00:00 2001 From: terry-xiaoyu <506895667@qq.com> Date: Sat, 20 Jul 2019 19:02:49 +0800 Subject: [PATCH 3/3] Fix websocket still send willmsg even after disconnect is received --- src/emqx_ws_channel.erl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/emqx_ws_channel.erl b/src/emqx_ws_channel.erl index 23a4d8d4c3..e8c86202ae 100644 --- a/src/emqx_ws_channel.erl +++ b/src/emqx_ws_channel.erl @@ -296,8 +296,8 @@ websocket_info({binary, Data}, State) -> websocket_info({shutdown, Reason}, State) -> shutdown(Reason, State); -websocket_info({stop, Reason}, State) -> - {stop, State#state{shutdown = Reason}}; +websocket_info(stop, State) -> + {stop, State}; websocket_info(Info = {'EXIT', SessionPid, Reason}, State = #state{proto_state = ProtoState}) -> case emqx_protocol:session(ProtoState) of @@ -363,12 +363,12 @@ ensure_stats_timer(State) -> State. shutdown(Reason = {shutdown, _}, State) -> - self() ! {stop, Reason}, - {ok, State}; + self() ! stop, + {ok, State#state{shutdown = Reason}}; shutdown(Reason, State) -> %% Fix the issue#2591(https://github.com/emqx/emqx/issues/2591#issuecomment-500278696) - self() ! {stop, {shutdown, Reason}}, - {ok, State}. + self() ! stop, + {ok, State#state{shutdown = {shutdown, Reason}}}. wsock_stats() -> [{Key, emqx_pd:get_counter(Key)} || Key <- ?SOCK_STATS].