chore: close keepalive timeout channel

This commit is contained in:
JianBo He 2022-08-09 11:04:51 +08:00
parent 7d3ea85ef3
commit 8186e9e47a
1 changed files with 3 additions and 1 deletions

View File

@ -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}) ->