fix: Fixes packet length checks (#953)
Fixes an issue with DropReq where an old client was sending in 14 bytes, but the server was expecting 15 bytes. To fix this we introduced a new packet handler, `ContainerGridPacketHandler` and changed the code to determine the length of the packet dynamically using `GetLength(NetState)`. Also fixed throttling so dropped packets are properly skipped.
This commit is contained in:
parent
1f4162288e
commit
58b907d39e
30 changed files with 1077 additions and 1126 deletions
|
|
@ -55,7 +55,7 @@ public static class IncomingAccountPackets
|
|||
IncomingPackets.Register(0xF8, 106, false, CreateCharacter);
|
||||
}
|
||||
|
||||
public static void CreateCharacter(NetState state, CircularBufferReader reader, ref int packetLength)
|
||||
public static void CreateCharacter(NetState state, CircularBufferReader reader, int packetLength)
|
||||
{
|
||||
reader.Seek(9, SeekOrigin.Current);
|
||||
/*
|
||||
|
|
@ -185,7 +185,7 @@ public static class IncomingAccountPackets
|
|||
}
|
||||
}
|
||||
|
||||
public static void DeleteCharacter(NetState state, CircularBufferReader reader, ref int packetLength)
|
||||
public static void DeleteCharacter(NetState state, CircularBufferReader reader, int packetLength)
|
||||
{
|
||||
reader.Seek(30, SeekOrigin.Current);
|
||||
var index = reader.ReadInt32();
|
||||
|
|
@ -193,24 +193,24 @@ public static class IncomingAccountPackets
|
|||
EventSink.InvokeDeleteRequest(state, index);
|
||||
}
|
||||
|
||||
public static void AccountID(NetState state, CircularBufferReader reader, ref int packetLength)
|
||||
public static void AccountID(NetState state, CircularBufferReader reader, int packetLength)
|
||||
{
|
||||
}
|
||||
|
||||
public static void AssistVersion(NetState state, CircularBufferReader reader, ref int packetLength)
|
||||
public static void AssistVersion(NetState state, CircularBufferReader reader, int packetLength)
|
||||
{
|
||||
var unk = reader.ReadInt32();
|
||||
var av = reader.ReadAscii();
|
||||
}
|
||||
|
||||
public static void ClientVersion(NetState state, CircularBufferReader reader, ref int packetLength)
|
||||
public static void ClientVersion(NetState state, CircularBufferReader reader, int packetLength)
|
||||
{
|
||||
var version = state.Version = new CV(reader.ReadAscii());
|
||||
|
||||
EventSink.InvokeClientVersionReceived(state, version);
|
||||
}
|
||||
|
||||
public static void ClientType(NetState state, CircularBufferReader reader, ref int packetLength)
|
||||
public static void ClientType(NetState state, CircularBufferReader reader, int packetLength)
|
||||
{
|
||||
reader.ReadUInt16();
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ public static class IncomingAccountPackets
|
|||
EventSink.InvokeClientVersionReceived(state, version);
|
||||
}
|
||||
|
||||
public static void PlayCharacter(NetState state, CircularBufferReader reader, ref int packetLength)
|
||||
public static void PlayCharacter(NetState state, CircularBufferReader reader, int packetLength)
|
||||
{
|
||||
reader.Seek(4, SeekOrigin.Current); // 0xEDEDEDED
|
||||
|
||||
|
|
@ -359,7 +359,7 @@ public static class IncomingAccountPackets
|
|||
return authID;
|
||||
}
|
||||
|
||||
public static void GameLogin(NetState state, CircularBufferReader reader, ref int packetLength)
|
||||
public static void GameLogin(NetState state, CircularBufferReader reader, int packetLength)
|
||||
{
|
||||
// TODO: Connection throttling
|
||||
|
||||
|
|
@ -413,7 +413,7 @@ public static class IncomingAccountPackets
|
|||
}
|
||||
}
|
||||
|
||||
public static void PlayServer(NetState state, CircularBufferReader reader, ref int packetLength)
|
||||
public static void PlayServer(NetState state, CircularBufferReader reader, int packetLength)
|
||||
{
|
||||
int index = reader.ReadInt16();
|
||||
var info = state.ServerInfo;
|
||||
|
|
@ -434,7 +434,7 @@ public static class IncomingAccountPackets
|
|||
}
|
||||
}
|
||||
|
||||
public static void LoginServerSeed(NetState state, CircularBufferReader reader, ref int packetLength)
|
||||
public static void LoginServerSeed(NetState state, CircularBufferReader reader, int packetLength)
|
||||
{
|
||||
state._seed = reader.ReadInt32();
|
||||
state.Seeded = true;
|
||||
|
|
@ -454,7 +454,7 @@ public static class IncomingAccountPackets
|
|||
state.Version = new ClientVersion(clientMaj, clientMin, clientRev, clientPat);
|
||||
}
|
||||
|
||||
public static void AccountLogin(NetState state, CircularBufferReader reader, ref int packetLength)
|
||||
public static void AccountLogin(NetState state, CircularBufferReader reader, int packetLength)
|
||||
{
|
||||
// TODO: Throttle Connection
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue