File tree Expand file tree Collapse file tree 3 files changed +16
-10
lines changed
Source/MQTTnet/Server/Internal Expand file tree Collapse file tree 3 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 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 ).
Original file line number Diff line number Diff line change 33on : [push, pull_request]
44
55env :
6- VERSION : " 4.1.0 .${{github.run_number}}"
6+ VERSION : " 4.1.1 .${{github.run_number}}"
77
88jobs :
99 build :
Original file line number Diff line number Diff 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 ( ) ;
You can’t perform that action at this time.
0 commit comments