From 258df6bb1434e6fa98114da52e55a5d092e15ace Mon Sep 17 00:00:00 2001 From: HansM Date: Thu, 11 Nov 2021 20:10:35 +0100 Subject: [PATCH] Removed IDisposable from MqttClientConnection class. (#1288) --- Build/MQTTnet.nuspec | 21 +------------------ .../Server/Internal/MqttClientConnection.cs | 10 ++------- .../Internal/MqttClientSessionsManager.cs | 2 -- 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/Build/MQTTnet.nuspec b/Build/MQTTnet.nuspec index df9fb118..b5003326 100644 --- a/Build/MQTTnet.nuspec +++ b/Build/MQTTnet.nuspec @@ -12,26 +12,7 @@ true MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker) and supports v3.1.0, v3.1.1 and v5.0.0 of the MQTT protocol. -* [Core] Added all builders to the MQTT factory. -* [Core] Removed global logger and refactored logging (BREAKING CHANGE!). -* [Client] Renamed _MqttClientConnectResult_ to _MqttClientConnectResult_ (BREAKING CHANGE!). -* [ManagedClient] Extended ReconnectAsync (thanks to @nvsnkv, #1202). -* [ManagedClient] Improved Amazon AWS support (thanks to @scottbrogden-iheartmedia, #1209). -* [ManagedClient] Fixed bug that allowed invalid subscriptions (Thanks to @marcelwinh). -* [Server] Added support for _RetainHandling_ (MQTTv5, BREAKING CHANGE!). -* [Server] Added support for _NoLocal_ (MQTTv5, BREAKING CHANGE!). -* [Server] Added support for _SubscriptionIdentifier_ (MQTTv5, BREAKING CHANGE!). -* [Server] Server now reports supported features properly after successful connection (MQTTv5, BREAKING CHANGE!). -* [Server] Fixed a memory/performance leak when using QoS Level 1. -* [Server] Exposed connection timestamp in client status. -* [Server] Refactored connection management code. -* [Server] Exposed more details in _MqttServerClientConnectedEventArgs_. -* [Server] Processing all pending messages before stopping (thanks to @AblEdge, #1234). -* [Server] Added support for a custom exception handler in _MqttServerMultiThreadedApplicationMessageInterceptorDelegate_. -* [Server] Removed logger from _MqttServerMultiThreadedApplicationMessageInterceptorDelegate_ (BREAKING CHANGE!). -* [Server] Fixed a memory leak when deleting sessions. -* [Server] Fixed timestamp check in server keep-alive monitor (thanks to @logicaloud, #1277). -* [MQTTnet.Server] Moved server project to a dedicated GitHub repository. +* [Core] Removed IDisposable from MqttClientConnection.cs (Fixes #1284). Git commit: $gitCommit Copyright Christian Kratky 2016-2021 diff --git a/Source/MQTTnet/Server/Internal/MqttClientConnection.cs b/Source/MQTTnet/Server/Internal/MqttClientConnection.cs index 9143c5c3..6081f273 100644 --- a/Source/MQTTnet/Server/Internal/MqttClientConnection.cs +++ b/Source/MQTTnet/Server/Internal/MqttClientConnection.cs @@ -1,11 +1,10 @@ -using System; +using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using MQTTnet.Adapter; using MQTTnet.Client; using MQTTnet.Client.Disconnecting; -using MQTTnet.Diagnostics; using MQTTnet.Diagnostics.Logger; using MQTTnet.Exceptions; using MQTTnet.Formatter; @@ -18,7 +17,7 @@ using MQTTnet.Server.Status; namespace MQTTnet.Server.Internal { - public sealed class MqttClientConnection : IDisposable + public sealed class MqttClientConnection { readonly Dictionary _topicAlias = new Dictionary(); readonly MqttPacketIdentifierProvider _packetIdentifierProvider = new MqttPacketIdentifierProvider(); @@ -107,11 +106,6 @@ namespace MQTTnet.Server.Internal Statistics.FillClientStatus(clientStatus); } - public void Dispose() - { - _cancellationToken.Dispose(); - } - public async Task RunAsync() { _logger.Info("Client '{0}': Session started.", ClientId); diff --git a/Source/MQTTnet/Server/Internal/MqttClientSessionsManager.cs b/Source/MQTTnet/Server/Internal/MqttClientSessionsManager.cs index 9793d868..8dccde9a 100644 --- a/Source/MQTTnet/Server/Internal/MqttClientSessionsManager.cs +++ b/Source/MQTTnet/Server/Internal/MqttClientSessionsManager.cs @@ -177,8 +177,6 @@ namespace MQTTnet.Server.Internal } } - clientConnection?.Dispose(); - await channelAdapter.DisconnectAsync(_options.DefaultCommunicationTimeout, CancellationToken.None) .ConfigureAwait(false); }