Skip to content

Commit

Permalink
Reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
chkr1011 committed Dec 10, 2024
1 parent 3a969c3 commit a396a2c
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions Source/MQTTnet.Server/Internal/MqttConnectedClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -74,6 +72,8 @@ public MqttConnectedClient(

public MqttClientStatistics Statistics { get; } = new();

public string UserName => ConnectPacket.Username;

public void Dispose()
{
_cancellationToken?.Dispose();
Expand Down Expand Up @@ -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)
{
Expand All @@ -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");
}
}
}

Expand Down

0 comments on commit a396a2c

Please sign in to comment.