Merge pull request #6527 from HJianBo/fix-receive-maximum-50

fix: disconnect the client due to exceed receive-maximum packets
This commit is contained in:
JianBo He 2021-12-27 09:13:24 +08:00 committed by GitHub
commit 523b5761b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -637,7 +637,7 @@ do_publish(PacketId, Msg = #message{qos = ?QOS_2},
packet_id => PacketId
}),
ok = emqx_metrics:inc('packets.publish.dropped'),
handle_out(pubrec, {PacketId, RC}, Channel)
handle_out(disconnect, RC, Channel)
end.
ensure_quota(_, Channel = #channel{quota = undefined}) ->

View File

@ -370,7 +370,8 @@ t_handle_in_qos2_publish_with_error_return(_) ->
{ok, ?PUBREC_PACKET(2, ?RC_NO_MATCHING_SUBSCRIBERS), Channel1} =
emqx_channel:handle_in(Publish2, Channel),
Publish3 = ?PUBLISH_PACKET(?QOS_2, <<"topic">>, 3, <<"payload">>),
{ok, ?PUBREC_PACKET(3, ?RC_RECEIVE_MAXIMUM_EXCEEDED), Channel1} =
{ok, [{outgoing, ?DISCONNECT_PACKET(?RC_RECEIVE_MAXIMUM_EXCEEDED)},
{close, receive_maximum_exceeded}], Channel1} =
emqx_channel:handle_in(Publish3, Channel1).
t_handle_in_puback_ok(_) ->