diff --git a/Build/MQTTnet.AspNetCore.nuspec b/Build/MQTTnet.AspNetCore.nuspec index 9cf4005..3071733 100644 --- a/Build/MQTTnet.AspNetCore.nuspec +++ b/Build/MQTTnet.AspNetCore.nuspec @@ -2,7 +2,7 @@ MQTTnet.AspNetCore - 2.5.0 + 2.5.1 Christian Kratky Christian Kratky https://github.com/chkr1011/MQTTnet/blob/master/LICENSE @@ -10,13 +10,13 @@ https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png false This is a support library to integrate MQTTnet into AspNetCore. - initial version + * Updated to MQTTnet 2.5.1. Copyright Christian Kratky 2016-2017 MQTT Message Queue Telemetry Transport MQTTClient MQTTServer Server MQTTBroker Broker NETStandard IoT InternetOfThings Messaging Hardware Arduino Sensor Actuator M2M ESP Smart Home Cities Automation Xamarin - + diff --git a/Build/MQTTnet.nuspec b/Build/MQTTnet.nuspec index 771f536..348ca79 100644 --- a/Build/MQTTnet.nuspec +++ b/Build/MQTTnet.nuspec @@ -10,14 +10,15 @@ https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png false MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker). - * + * Fixed several library reference issues. +* [Client] Fixed issue in _MqttClientOptionsBuilder_ when using no certificates (Thanks to 1iveowl). Copyright Christian Kratky 2016-2017 MQTT Message Queue Telemetry Transport MQTTClient MQTTServer Server MQTTBroker Broker NETStandard IoT InternetOfThings Messaging Hardware Arduino Sensor Actuator M2M ESP Smart Home Cities Automation Xamarin - + @@ -45,7 +46,7 @@ - + diff --git a/MQTTnet.Core/Client/MqttClientOptionsBuilder.cs b/MQTTnet.Core/Client/MqttClientOptionsBuilder.cs index 29a2d64..fb18cc0 100644 --- a/MQTTnet.Core/Client/MqttClientOptionsBuilder.cs +++ b/MQTTnet.Core/Client/MqttClientOptionsBuilder.cs @@ -98,7 +98,7 @@ namespace MQTTnet.Core.Client AllowUntrustedCertificates = allowUntrustedCertificates, IgnoreCertificateChainErrors = ignoreCertificateChainErrors, IgnoreCertificateRevocationErrors = ignoreCertificateRevocationErrors, - Certificates = certificates.ToList() + Certificates = certificates?.ToList() }; return this; diff --git a/MQTTnet.Core/Server/MqttClientPendingMessagesQueue.cs b/MQTTnet.Core/Server/MqttClientPendingMessagesQueue.cs index 6b370db..1e0fc76 100644 --- a/MQTTnet.Core/Server/MqttClientPendingMessagesQueue.cs +++ b/MQTTnet.Core/Server/MqttClientPendingMessagesQueue.cs @@ -28,6 +28,11 @@ namespace MQTTnet.Core.Server { if (adapter == null) throw new ArgumentNullException(nameof(adapter)); + if (cancellationToken.IsCancellationRequested) + { + return; + } + Task.Run(async () => await SendPendingPublishPacketsAsync(adapter, cancellationToken), cancellationToken).ConfigureAwait(false); } diff --git a/MQTTnet.Core/Server/MqttClientSession.cs b/MQTTnet.Core/Server/MqttClientSession.cs index cbdfc73..93b422f 100644 --- a/MQTTnet.Core/Server/MqttClientSession.cs +++ b/MQTTnet.Core/Server/MqttClientSession.cs @@ -60,12 +60,14 @@ namespace MQTTnet.Core.Server try { + var cancellationTokenSource = new CancellationTokenSource(); + _willMessage = willMessage; _adapter = adapter; - _cancellationTokenSource = new CancellationTokenSource(); + _cancellationTokenSource = cancellationTokenSource; - _pendingMessagesQueue.Start(adapter, _cancellationTokenSource.Token); - await ReceivePacketsAsync(adapter, _cancellationTokenSource.Token).ConfigureAwait(false); + _pendingMessagesQueue.Start(adapter, cancellationTokenSource.Token); + await ReceivePacketsAsync(adapter, cancellationTokenSource.Token).ConfigureAwait(false); } catch (OperationCanceledException) {