Просмотр исходного кода

Even more performance optimizations

release/3.x.x
Christian Kratky 7 лет назад
Родитель
Сommit
6b1a6c054e
6 измененных файлов: 14 добавлений и 11 удалений
  1. +1
    -1
      MQTTnet.Core/Packets/MqttConnAckPacket.cs
  2. +2
    -2
      MQTTnet.Core/Packets/MqttConnectPacket.cs
  3. +8
    -3
      MQTTnet.Core/Packets/MqttPublishPacket.cs
  4. +1
    -2
      MQTTnet.Core/Packets/MqttSubAckPacket.cs
  5. +1
    -2
      MQTTnet.Core/Packets/MqttSubscribePacket.cs
  6. +1
    -1
      MQTTnet.Core/Server/MqttClientSession.cs

+ 1
- 1
MQTTnet.Core/Packets/MqttConnAckPacket.cs Просмотреть файл

@@ -10,7 +10,7 @@ namespace MQTTnet.Core.Packets

public override string ToString()
{
return $"{nameof(MqttConnAckPacket)}: [ConnectReturnCode={ConnectReturnCode}] [IsSessionPresent={IsSessionPresent}]";
return nameof(MqttConnAckPacket) + ": [ConnectReturnCode=" + ConnectReturnCode + "] [IsSessionPresent=" + IsSessionPresent + "]";
}
}
}

+ 2
- 2
MQTTnet.Core/Packets/MqttConnectPacket.cs Просмотреть файл

@@ -2,7 +2,7 @@

namespace MQTTnet.Core.Packets
{
public sealed class MqttConnectPacket: MqttBasePacket
public sealed class MqttConnectPacket : MqttBasePacket
{
public MqttProtocolVersion ProtocolVersion { get; set; }

@@ -20,7 +20,7 @@ namespace MQTTnet.Core.Packets

public override string ToString()
{
return $"{nameof(MqttConnectPacket)} [ClientId={ClientId}] [Username={Username}] [Password={Password}] [KeepAlivePeriod={KeepAlivePeriod}] [CleanSession={CleanSession}]";
return nameof(MqttConnectPacket) + ": [ClientId=" + ClientId + "] [Username=" + Username + "] [Password=" + Password + "] [KeepAlivePeriod=" + KeepAlivePeriod + "] [CleanSession=" + CleanSession + "]";
}
}
}

+ 8
- 3
MQTTnet.Core/Packets/MqttPublishPacket.cs Просмотреть файл

@@ -1,4 +1,4 @@
using System.Text;
using System;
using MQTTnet.Core.Protocol;

namespace MQTTnet.Core.Packets
@@ -17,8 +17,13 @@ namespace MQTTnet.Core.Packets

public override string ToString()
{
return
$"{nameof(MqttPublishPacket)} [Topic={Topic}] [Payload={Encoding.UTF8.GetString(Payload, 0, Payload.Length)}] [QoSLevel={QualityOfServiceLevel}] [Dup={Dup}] [Retain={Retain}] [PacketIdentifier={PacketIdentifier}]";
return nameof(MqttPublishPacket) +
": [Topic=" + Topic + "]" +
" [Payload=" + Convert.ToBase64String(Payload) + "]" +
" [QoSLevel=" + QualityOfServiceLevel + "]" +
" [Dup=" + Dup + "]" +
" [Retain=" + Retain + "]" +
" [PacketIdentifier=" + PacketIdentifier + "]";
}
}
}

+ 1
- 2
MQTTnet.Core/Packets/MqttSubAckPacket.cs Просмотреть файл

@@ -13,8 +13,7 @@ namespace MQTTnet.Core.Packets
public override string ToString()
{
var subscribeReturnCodesText = string.Join(",", SubscribeReturnCodes.Select(f => f.ToString()));
return
$"{nameof(MqttSubAckPacket)} [PacketIdentifier={PacketIdentifier}] [SubscribeReturnCodes={subscribeReturnCodesText}]";
return nameof(MqttSubAckPacket) + ": [PacketIdentifier=" + PacketIdentifier + "] [SubscribeReturnCodes=" + subscribeReturnCodesText + "]";
}
}
}

+ 1
- 2
MQTTnet.Core/Packets/MqttSubscribePacket.cs Просмотреть файл

@@ -12,8 +12,7 @@ namespace MQTTnet.Core.Packets
public override string ToString()
{
var topicFiltersText = string.Join(",", TopicFilters.Select(f => $"{f.Topic}@{f.QualityOfServiceLevel}"));
return
$"{nameof(MqttSubscribePacket)} [PacketIdentifier={PacketIdentifier}] [TopicFilters={topicFiltersText}]";
return nameof(MqttSubscribePacket) + ": [PacketIdentifier=" + PacketIdentifier + "] [TopicFilters=" + topicFiltersText + "]";
}
}
}

+ 1
- 1
MQTTnet.Core/Server/MqttClientSession.cs Просмотреть файл

@@ -76,7 +76,7 @@ namespace MQTTnet.Core.Server
_cancellationTokenSource.Cancel();
Adapter = null;

MqttTrace.Information(nameof(MqttClientSession), $"Client '{_identifier}': Disconnected.");
MqttTrace.Information(nameof(MqttClientSession), "Client '{0}': Disconnected.", _identifier);
}
}



Загрузка…
Отмена
Сохранить