From 4105beb7e68a7068d9b9d3b9dacd71af8eaec828 Mon Sep 17 00:00:00 2001 From: Lucas Rosa Date: Tue, 29 Oct 2019 12:55:57 -0300 Subject: [PATCH] Some more cleaning up: --- Source/MQTTnet/Server/MqttClientConnection.cs | 1 - Source/MQTTnet/Server/MqttClientSessionsManager.cs | 9 +++------ Source/MQTTnet/Server/MqttClientSubscriptionsManager.cs | 2 +- Source/MQTTnet/Server/MqttServerEventDispatcher.cs | 1 - 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Source/MQTTnet/Server/MqttClientConnection.cs b/Source/MQTTnet/Server/MqttClientConnection.cs index a114e28..e71d1a8 100644 --- a/Source/MQTTnet/Server/MqttClientConnection.cs +++ b/Source/MQTTnet/Server/MqttClientConnection.cs @@ -12,7 +12,6 @@ using MQTTnet.PacketDispatcher; using MQTTnet.Packets; using MQTTnet.Protocol; using MQTTnet.Server.Status; -using static MQTTnet.Server.MqttClientSessionsManager; namespace MQTTnet.Server { diff --git a/Source/MQTTnet/Server/MqttClientSessionsManager.cs b/Source/MQTTnet/Server/MqttClientSessionsManager.cs index 5a27b46..b800d85 100644 --- a/Source/MQTTnet/Server/MqttClientSessionsManager.cs +++ b/Source/MQTTnet/Server/MqttClientSessionsManager.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.IO; using System.Threading; using System.Threading.Tasks; using MQTTnet.Adapter; @@ -231,8 +230,7 @@ namespace MQTTnet.Server { var disconnectType = MqttClientDisconnectType.NotClean; string clientId = null; - - var ok = true; + var clientWasConnected = true; try { @@ -249,7 +247,7 @@ namespace MQTTnet.Server if (connectionValidatorContext.ReasonCode != MqttConnectReasonCode.Success) { - ok = false; + clientWasConnected = false; // Send failure response here without preparing a session. The result for a successful connect // will be sent from the session itself. var connAckPacket = channelAdapter.PacketFormatterAdapter.DataConverter.CreateConnAckPacket(connectionValidatorContext); @@ -263,7 +261,6 @@ namespace MQTTnet.Server await _eventDispatcher.HandleClientConnectedAsync(clientId).ConfigureAwait(false); disconnectType = await connection.RunAsync().ConfigureAwait(false); - } catch (OperationCanceledException) { @@ -274,7 +271,7 @@ namespace MQTTnet.Server } finally { - if (ok) + if (clientWasConnected) { if (clientId != null) { diff --git a/Source/MQTTnet/Server/MqttClientSubscriptionsManager.cs b/Source/MQTTnet/Server/MqttClientSubscriptionsManager.cs index 1d675ba..c84a018 100644 --- a/Source/MQTTnet/Server/MqttClientSubscriptionsManager.cs +++ b/Source/MQTTnet/Server/MqttClientSubscriptionsManager.cs @@ -4,7 +4,6 @@ using System.Linq; using System.Threading.Tasks; using MQTTnet.Packets; using MQTTnet.Protocol; -using static MQTTnet.Server.MqttClientSessionsManager; namespace MQTTnet.Server { @@ -158,6 +157,7 @@ namespace MQTTnet.Server { continue; } + qosLevels.Add(subscription.Value.QualityOfServiceLevel); } } diff --git a/Source/MQTTnet/Server/MqttServerEventDispatcher.cs b/Source/MQTTnet/Server/MqttServerEventDispatcher.cs index f899081..e6e608a 100644 --- a/Source/MQTTnet/Server/MqttServerEventDispatcher.cs +++ b/Source/MQTTnet/Server/MqttServerEventDispatcher.cs @@ -2,7 +2,6 @@ using System.Threading.Tasks; using MQTTnet.Client.Receiving; using MQTTnet.Diagnostics; -using static MQTTnet.Server.MqttClientSessionsManager; namespace MQTTnet.Server {