Skip to content

Commit c009cbe

Browse files
committed
Update comments, release notes, version.
1 parent 37e60c7 commit c009cbe

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

.github/workflows/ReleaseNotes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
* [Core] MQTT Packets being sent over web socket transport are now setting the web socket frame boundaries correctly (#1499).
12
* [Client] Keep alive mechanism now uses the configured timeout value from the options (thanks to @Stannieman, #1495).
2-
* [Core] MQTT Packets being sent over web socket transport are now setting the web socket frame boundaries correctly (#1499).
3+
* [Server] A DISCONNECT packet is no longer sent to MQTT clients < 5.0.0 (thanks to @logicaloud, #1506).

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CI
33
on: [push, pull_request]
44

55
env:
6-
VERSION: "4.1.0.${{github.run_number}}"
6+
VERSION: "4.1.1.${{github.run_number}}"
77

88
jobs:
99
build:

Source/MQTTnet/Server/Internal/MqttClient.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,20 @@ public async Task StopAsync(MqttDisconnectReasonCode reason)
147147
{
148148
IsRunning = false;
149149

150-
// Potentially send disconnect reason to MQTT 5 clients
151-
152-
if (ChannelAdapter.PacketFormatterAdapter.ProtocolVersion == MqttProtocolVersion.V500 && reason != MqttDisconnectReasonCode.NormalDisconnection)
150+
// Sending DISCONNECT packets from the server to the client is only supported when using MQTTv5+.
151+
if (ChannelAdapter.PacketFormatterAdapter.ProtocolVersion == MqttProtocolVersion.V500)
153152
{
154-
// Is is very important to send the DISCONNECT packet here BEFORE cancelling the
155-
// token because the entire connection is closed (disposed) as soon as the cancellation
156-
// token is cancelled. To there is no chance that the DISCONNECT packet will ever arrive
157-
// at the client!
158-
await TrySendDisconnectPacket(reason).ConfigureAwait(false);
153+
// The Client or Server MAY send a DISCONNECT packet before closing the Network Connection.
154+
// This library does not sent a DISCONNECT packet for a normal disconnection. Maybe adding
155+
// a configuration option is requested in the future.
156+
if (reason != MqttDisconnectReasonCode.NormalDisconnection)
157+
{
158+
// Is is very important to send the DISCONNECT packet here BEFORE cancelling the
159+
// token because the entire connection is closed (disposed) as soon as the cancellation
160+
// token is cancelled. To there is no chance that the DISCONNECT packet will ever arrive
161+
// at the client!
162+
await TrySendDisconnectPacket(reason).ConfigureAwait(false);
163+
}
159164
}
160165

161166
StopInternal();

0 commit comments

Comments
 (0)