Updates Pipe & Makes NetState more testable (#288)

Updates pipe eliminate result and segments from being allocated.

Bumps release version
This commit is contained in:
Kamron Batman 2020-10-25 17:40:08 -07:00 • committed by GitHub
parent 293e691539
commit 990e6fe188
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 219 additions and 198 deletions

View file

@ -14,6 +14,7 @@
*************************************************************************/
using System;
using System.Buffers;
using System.Collections.Generic;
using System.IO;
using Server.ContextMenus;
@ -46,8 +47,6 @@ namespace Server.Network
public static class PacketHandlers
{
public delegate void PlayCharCallback(NetState state, bool val);
private const int m_AuthIDWindowSize = 128;
private static readonly PacketHandler[] m_6017Handlers = new PacketHandler[0x100];
@ -154,9 +153,6 @@ namespace Server.Network
RegisterEncoded(0x32, true, QuestGumpRequest);
}
public static PlayCharCallback ThirdPartyAuthCallback { get; set; }
public static PlayCharCallback ThirdPartyHackedCallback { get; set; }
public static PacketHandler[] Handlers { get; } = new PacketHandler[0x100];
public static bool SingleClickProps { get; set; }
@ -281,9 +277,9 @@ namespace Server.Network
}
}
public static int ProcessPacket(NetState ns, ArraySegment<byte>[] segments)
public static int ProcessPacket(NetState ns, ref CircularBuffer<byte> buffer)
{
var reader = new CircularBufferReader(segments);
var reader = new CircularBufferReader(ref buffer);
var packetId = reader.ReadByte();