mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-20 03:24:33 +08:00
Send DISCONNECT packets to MQTT5 clients only (#1506)
This commit is contained in:
@@ -147,7 +147,9 @@ namespace MQTTnet.Server
|
||||
{
|
||||
IsRunning = false;
|
||||
|
||||
if (reason == MqttDisconnectReasonCode.SessionTakenOver || reason == MqttDisconnectReasonCode.KeepAliveTimeout)
|
||||
// Potentially send disconnect reason to MQTT 5 clients
|
||||
|
||||
if (ChannelAdapter.PacketFormatterAdapter.ProtocolVersion == MqttProtocolVersion.V500 && reason != MqttDisconnectReasonCode.NormalDisconnection)
|
||||
{
|
||||
// Is is very important to send the DISCONNECT packet here BEFORE cancelling the
|
||||
// token because the entire connection is closed (disposed) as soon as the cancellation
|
||||
|
||||
Reference in New Issue
Block a user