From a396a2ca754003679eae70269877d943b6dadf27 Mon Sep 17 00:00:00 2001 From: christian <6939810+chkr1011@users.noreply.github.com> Date: Tue, 10 Dec 2024 19:43:51 +0100 Subject: [PATCH] Reformat code --- .../Internal/MqttConnectedClient.cs | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/Source/MQTTnet.Server/Internal/MqttConnectedClient.cs b/Source/MQTTnet.Server/Internal/MqttConnectedClient.cs index 7bf924af7..bfdb21307 100644 --- a/Source/MQTTnet.Server/Internal/MqttConnectedClient.cs +++ b/Source/MQTTnet.Server/Internal/MqttConnectedClient.cs @@ -62,8 +62,6 @@ public MqttConnectedClient( public string Id => ConnectPacket.ClientId; - public string UserName => ConnectPacket.Username; - public bool IsRunning { get; private set; } public bool IsTakenOver { get; set; } @@ -74,6 +72,8 @@ public MqttConnectedClient( public MqttClientStatistics Statistics { get; } = new(); + public string UserName => ConnectPacket.Username; + public void Dispose() { _cancellationToken?.Dispose(); @@ -219,7 +219,8 @@ async Task HandleIncomingPublishPacket(MqttPublishPacket publishPacket, Cancella var applicationMessage = MqttApplicationMessageFactory.Create(publishPacket); - var dispatchApplicationMessageResult = await _sessionsManager.DispatchApplicationMessage(Id, UserName, Session.Items, applicationMessage, cancellationToken).ConfigureAwait(false); + var dispatchApplicationMessageResult = + await _sessionsManager.DispatchApplicationMessage(Id, UserName, Session.Items, applicationMessage, cancellationToken).ConfigureAwait(false); if (dispatchApplicationMessageResult.CloseConnection) { @@ -230,26 +231,26 @@ async Task HandleIncomingPublishPacket(MqttPublishPacket publishPacket, Cancella switch (publishPacket.QualityOfServiceLevel) { case MqttQualityOfServiceLevel.AtMostOnce: - { - // Do nothing since QoS 0 has no ACK at all! - break; - } + { + // Do nothing since QoS 0 has no ACK at all! + break; + } case MqttQualityOfServiceLevel.AtLeastOnce: - { - var pubAckPacket = MqttPubAckPacketFactory.Create(publishPacket, dispatchApplicationMessageResult); - Session.EnqueueControlPacket(new MqttPacketBusItem(pubAckPacket)); - break; - } + { + var pubAckPacket = MqttPubAckPacketFactory.Create(publishPacket, dispatchApplicationMessageResult); + Session.EnqueueControlPacket(new MqttPacketBusItem(pubAckPacket)); + break; + } case MqttQualityOfServiceLevel.ExactlyOnce: - { - var pubRecPacket = MqttPubRecPacketFactory.Create(publishPacket, dispatchApplicationMessageResult); - Session.EnqueueControlPacket(new MqttPacketBusItem(pubRecPacket)); - break; - } + { + var pubRecPacket = MqttPubRecPacketFactory.Create(publishPacket, dispatchApplicationMessageResult); + Session.EnqueueControlPacket(new MqttPacketBusItem(pubRecPacket)); + break; + } default: - { - throw new MqttCommunicationException("Received a not supported QoS level"); - } + { + throw new MqttCommunicationException("Received a not supported QoS level"); + } } }