mirror of
https://github.com/RRQM/TouchSocket.git
synced 2025-12-18 01:16:44 +08:00
发布:3.1.13
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
@@ -1655,4 +1656,4 @@ public sealed partial class TouchSocketBitConverter
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,11 @@ using TouchSocket.Core;
|
||||
|
||||
namespace TouchSocket.Mqtt;
|
||||
|
||||
internal class MqttAdapter : CustomDataHandlingAdapter<MqttMessage>
|
||||
public class MqttAdapter : CustomDataHandlingAdapter<MqttMessage>
|
||||
{
|
||||
public override bool CanSendRequestInfo => true;
|
||||
|
||||
public MqttProtocolVersion Version { get; private set; } = MqttProtocolVersion.Unknown;
|
||||
public MqttProtocolVersion Version { get; private set; } = MqttProtocolVersion.V311;
|
||||
|
||||
protected override FilterResult Filter<TByteBlock>(ref TByteBlock byteBlock, bool beCached, ref MqttMessage request, ref int tempCapacity)
|
||||
{
|
||||
@@ -51,7 +51,7 @@ internal class MqttAdapter : CustomDataHandlingAdapter<MqttMessage>
|
||||
|
||||
byteBlock.Position = position;
|
||||
mqttMessage.Unpack(ref byteBlock);
|
||||
if (byteBlock.Position != position + remainingLength + 2)
|
||||
if (byteBlock.Position != position + remainingLength + 1+MqttExtension.GetVariableByteIntegerCount((int)remainingLength))
|
||||
{
|
||||
throw new Exception("存在没有读取的数据");
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ namespace TouchSocket.Mqtt;
|
||||
|
||||
public static class MqttUtility
|
||||
{
|
||||
public const string MqttProtocolName = "Mqtt";
|
||||
public static ReadOnlySpan<byte> MqttProtocolNameSpan => Encoding.UTF8.GetBytes("Mqtt");
|
||||
public const string MqttProtocolName = "MQTT";
|
||||
public static ReadOnlySpan<byte> MqttProtocolNameSpan => Encoding.UTF8.GetBytes("MQTT");
|
||||
|
||||
public static IReadOnlyList<MqttUserProperty> EmptyUserProperties { get; } = [];
|
||||
}
|
||||
@@ -40,13 +40,15 @@ internal ref struct VariableByteIntegerRecorder
|
||||
if (lenCount > this.m_minimumCount)
|
||||
{
|
||||
var moveCount = lenCount - this.m_minimumCount;
|
||||
//len += moveCount;
|
||||
|
||||
byteBlock.ExtendSize(moveCount);
|
||||
var span = byteBlock.TotalMemory.Span.Slice(this.m_dataPosition);
|
||||
ShiftWithRight(span, moveCount);
|
||||
|
||||
byteBlock.Position = this.m_startPosition;
|
||||
MqttExtension.WriteVariableByteInteger(ref byteBlock, (uint)len);
|
||||
byteBlock.SetLength(endPosition);
|
||||
byteBlock.SetLength(endPosition+ moveCount);
|
||||
byteBlock.SeekToEnd();
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user