fix: keep the real closed_reason
This commit is contained in:
parent
2e4ec4888d
commit
5256d8092c
|
@ -297,7 +297,7 @@ handle_timeout(
|
||||||
NChannel = remove_timer_ref(alive_timer, Channel),
|
NChannel = remove_timer_ref(alive_timer, Channel),
|
||||||
%% close connection if keepalive timeout
|
%% close connection if keepalive timeout
|
||||||
Replies = [{event, disconnected}, {close, keepalive_timeout}],
|
Replies = [{event, disconnected}, {close, keepalive_timeout}],
|
||||||
NChannel1 = dispatch(on_timer_timeout, Req, NChannel),
|
NChannel1 = dispatch(on_timer_timeout, Req, NChannel#channel{closed_reason = keepalive_timeout}),
|
||||||
{ok, Replies, NChannel1}
|
{ok, Replies, NChannel1}
|
||||||
end;
|
end;
|
||||||
handle_timeout(_TRef, force_close, Channel = #channel{closed_reason = Reason}) ->
|
handle_timeout(_TRef, force_close, Channel = #channel{closed_reason = Reason}) ->
|
||||||
|
@ -497,7 +497,7 @@ handle_cast(Req, Channel) ->
|
||||||
| {shutdown, Reason :: term(), channel()}.
|
| {shutdown, Reason :: term(), channel()}.
|
||||||
handle_info(
|
handle_info(
|
||||||
{sock_closed, Reason},
|
{sock_closed, Reason},
|
||||||
Channel = #channel{gcli = GClient}
|
Channel = #channel{gcli = GClient, closed_reason = ClosedReason}
|
||||||
) ->
|
) ->
|
||||||
case emqx_exproto_gcli:is_empty(GClient) of
|
case emqx_exproto_gcli:is_empty(GClient) of
|
||||||
true ->
|
true ->
|
||||||
|
@ -505,7 +505,12 @@ handle_info(
|
||||||
{shutdown, Reason, Channel1};
|
{shutdown, Reason, Channel1};
|
||||||
_ ->
|
_ ->
|
||||||
%% delayed close process for flushing all callback funcs to gRPC server
|
%% delayed close process for flushing all callback funcs to gRPC server
|
||||||
Channel1 = Channel#channel{closed_reason = Reason},
|
Channel1 = case ClosedReason of
|
||||||
|
undefined ->
|
||||||
|
Channel#channel{closed_reason = Reason};
|
||||||
|
_ ->
|
||||||
|
Channel
|
||||||
|
end,
|
||||||
Channel2 = ensure_timer(force_timer, Channel1),
|
Channel2 = ensure_timer(force_timer, Channel1),
|
||||||
{ok, ensure_disconnected(Reason, Channel2)}
|
{ok, ensure_disconnected(Reason, Channel2)}
|
||||||
end;
|
end;
|
||||||
|
|
|
@ -13,8 +13,7 @@ of requests in `ConnectionHandler`. But unfortunately, events between different
|
||||||
streams are out of order. It causes the `OnSocketCreated` event to may arrive
|
streams are out of order. It causes the `OnSocketCreated` event to may arrive
|
||||||
later than `OnReceivedBytes`.
|
later than `OnReceivedBytes`.
|
||||||
So we added the `ConnectionUnaryHandler` service since v5.0.25 and forced
|
So we added the `ConnectionUnaryHandler` service since v5.0.25 and forced
|
||||||
the use of Unary in it to avoid ordering problems.
|
the use of Unary in it to avoid ordering problems."""
|
||||||
"""
|
|
||||||
|
|
||||||
exproto_grpc_handler_ssl.desc:
|
exproto_grpc_handler_ssl.desc:
|
||||||
"""SSL configuration for the gRPC client."""
|
"""SSL configuration for the gRPC client."""
|
||||||
|
|
Loading…
Reference in New Issue