removed dead code and make new connection context an opt in so kestrel 2.0 still works

This commit is contained in:
JanEggers
2018-06-16 17:20:01 +02:00
parent d5ac8c7183
commit 7c2adf636f
4 changed files with 19 additions and 66 deletions
@@ -4,7 +4,6 @@ using System.IO;
using MQTTnet.Adapter;
using MQTTnet.Exceptions;
using MQTTnet.Packets;
using MQTTnet.Protocol;
using MQTTnet.Serializer;
namespace MQTTnet.AspNetCore
@@ -59,30 +58,6 @@ namespace MQTTnet.AspNetCore
return input.ToArray();
}
public static bool TryDeserialize(this IMqttPacketSerializer serializer, ref ReadOnlySequence<byte> input, out MqttBasePacket packet)
{
packet = null;
var copy = input;
if (copy.Length < 2)
{
return false;
}
var fixedheader = copy.First.Span[0];
if (!TryReadBodyLength(ref copy, out var bodyLength))
{
return false;
}
input = copy.Slice(bodyLength);
var bodySlice = copy.Slice(0, bodyLength);
using (var body = new MemoryStream(bodySlice.GetArray()))
{
packet = serializer.Deserialize(new ReceivedMqttPacket(fixedheader, body));
return true;
}
}
public static bool TryDeserialize(this IMqttPacketSerializer serializer, in ReadOnlySequence<byte> input, out MqttBasePacket packet, out SequencePosition consumed, out SequencePosition observed)
{
packet = null;