fix: Fixes CUO connecting with new TCP Peek Filtering (#2137)

This commit is contained in:
Kamron Batman 2025-03-04 11:00:20 -08:00 committed by GitHub
parent 49fd5f210d
commit ad361001c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -169,13 +169,15 @@ public static class TcpServer
var bytesRead = await socket.ReceiveAsync(firstBytes, SocketFlags.Peek, cts.Token);
var isValid =
// Older clients only send the 4 byte seed first
(UOClient.MinRequired == null || UOClient.MinRequired < ClientVersion.Version6050) && bytesRead == 4 ||
// Older clients only send the 4 byte seed first then 0x80
(UOClient.MinRequired == null || UOClient.MinRequired < ClientVersion.Version6050) && (
bytesRead == 4 || bytesRead >= 66 && firstBytes[4] == 0x80) ||
// Newer clients
(UOClient.MaxRequired == null || UOClient.MaxRequired >= ClientVersion.Version6050) && (
// Account Login - 0xEF + 0x80 (83 bytes)
bytesRead >= 83 && firstBytes[0] == 0xEF && firstBytes[21] == 0x80 ||
// Game Login - 4 bytes + 0x91 (69 bytes)
firstBytes[4] == 0x91 && bytesRead >= 69
bytesRead >= 69 && firstBytes[4] == 0x91
);
// TODO: Validate client version is v4 -> v7 for 0xEF packet