From 8186e9e47a62d9350d054cd78d46a778c6c46225 Mon Sep 17 00:00:00 2001 From: JianBo He Date: Tue, 9 Aug 2022 11:04:51 +0800 Subject: [PATCH] chore: close keepalive timeout channel --- apps/emqx_exproto/src/emqx_exproto_channel.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/emqx_exproto/src/emqx_exproto_channel.erl b/apps/emqx_exproto/src/emqx_exproto_channel.erl index 50dd203b6..cf6229be3 100644 --- a/apps/emqx_exproto/src/emqx_exproto_channel.erl +++ b/apps/emqx_exproto/src/emqx_exproto_channel.erl @@ -275,7 +275,9 @@ handle_timeout(_TRef, {keepalive, StatVal}, {error, timeout} -> Req = #{type => 'KEEPALIVE'}, NChannel = clean_timer(alive_timer, Channel), - {ok, try_dispatch(on_timer_timeout, wrap(Req), NChannel)} + %% close connection if keepalive timeout + Replies = [{event, disconnected}, {close, normal}], + {ok, Replies, try_dispatch(on_timer_timeout, wrap(Req), NChannel)} end; handle_timeout(_TRef, force_close, Channel = #channel{closed_reason = Reason}) ->