Removed IDisposable from MqttClientConnection class. (#1288)

This commit is contained in:
HansM
2021-11-11 20:10:35 +01:00
committed by GitHub
parent 85c3c0b352
commit 258df6bb14
3 changed files with 3 additions and 30 deletions
+1 -20
View File
@@ -12,26 +12,7 @@
<requireLicenseAcceptance>true</requireLicenseAcceptance> <requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>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.</description> <description>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.</description>
<releaseNotes> <releaseNotes>
* [Core] Added all builders to the MQTT factory. * [Core] Removed IDisposable from MqttClientConnection.cs (Fixes #1284).
* [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.
Git commit: $gitCommit Git commit: $gitCommit
</releaseNotes> </releaseNotes>
<copyright>Copyright Christian Kratky 2016-2021</copyright> <copyright>Copyright Christian Kratky 2016-2021</copyright>
@@ -1,11 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MQTTnet.Adapter; using MQTTnet.Adapter;
using MQTTnet.Client; using MQTTnet.Client;
using MQTTnet.Client.Disconnecting; using MQTTnet.Client.Disconnecting;
using MQTTnet.Diagnostics;
using MQTTnet.Diagnostics.Logger; using MQTTnet.Diagnostics.Logger;
using MQTTnet.Exceptions; using MQTTnet.Exceptions;
using MQTTnet.Formatter; using MQTTnet.Formatter;
@@ -18,7 +17,7 @@ using MQTTnet.Server.Status;
namespace MQTTnet.Server.Internal namespace MQTTnet.Server.Internal
{ {
public sealed class MqttClientConnection : IDisposable public sealed class MqttClientConnection
{ {
readonly Dictionary<ushort, string> _topicAlias = new Dictionary<ushort, string>(); readonly Dictionary<ushort, string> _topicAlias = new Dictionary<ushort, string>();
readonly MqttPacketIdentifierProvider _packetIdentifierProvider = new MqttPacketIdentifierProvider(); readonly MqttPacketIdentifierProvider _packetIdentifierProvider = new MqttPacketIdentifierProvider();
@@ -107,11 +106,6 @@ namespace MQTTnet.Server.Internal
Statistics.FillClientStatus(clientStatus); Statistics.FillClientStatus(clientStatus);
} }
public void Dispose()
{
_cancellationToken.Dispose();
}
public async Task RunAsync() public async Task RunAsync()
{ {
_logger.Info("Client '{0}': Session started.", ClientId); _logger.Info("Client '{0}': Session started.", ClientId);
@@ -177,8 +177,6 @@ namespace MQTTnet.Server.Internal
} }
} }
clientConnection?.Dispose();
await channelAdapter.DisconnectAsync(_options.DefaultCommunicationTimeout, CancellationToken.None) await channelAdapter.DisconnectAsync(_options.DefaultCommunicationTimeout, CancellationToken.None)
.ConfigureAwait(false); .ConfigureAwait(false);
} }