Fixes disconnect when trying to login with a higher ping. Client will send multi proto packets in same packet.

This commit is contained in:
hondacrx
2022-09-28 20:30:47 -04:00
parent b3a1f085ca
commit a30e1d230f
3 changed files with 15 additions and 7 deletions
+2 -2
View File
@@ -63,8 +63,8 @@ Global
{3B8C9AB8-2DC3-4655-BF67-AE2001D3B4F6}.Release|mac-x64.Build.0 = Release|mac-x64 {3B8C9AB8-2DC3-4655-BF67-AE2001D3B4F6}.Release|mac-x64.Build.0 = Release|mac-x64
{3B8C9AB8-2DC3-4655-BF67-AE2001D3B4F6}.Release|win-x64.ActiveCfg = Release|win-x64 {3B8C9AB8-2DC3-4655-BF67-AE2001D3B4F6}.Release|win-x64.ActiveCfg = Release|win-x64
{3B8C9AB8-2DC3-4655-BF67-AE2001D3B4F6}.Release|win-x64.Build.0 = Release|win-x64 {3B8C9AB8-2DC3-4655-BF67-AE2001D3B4F6}.Release|win-x64.Build.0 = Release|win-x64
{1899C17C-1FA4-4807-B90E-0336C5748C1A}.Debug|linux-x64.ActiveCfg = Debug|x64 {1899C17C-1FA4-4807-B90E-0336C5748C1A}.Debug|linux-x64.ActiveCfg = Debug|linux-x64
{1899C17C-1FA4-4807-B90E-0336C5748C1A}.Debug|linux-x64.Build.0 = Debug|x64 {1899C17C-1FA4-4807-B90E-0336C5748C1A}.Debug|linux-x64.Build.0 = Debug|linux-x64
{1899C17C-1FA4-4807-B90E-0336C5748C1A}.Debug|mac-x64.ActiveCfg = Debug|mac-x64 {1899C17C-1FA4-4807-B90E-0336C5748C1A}.Debug|mac-x64.ActiveCfg = Debug|mac-x64
{1899C17C-1FA4-4807-B90E-0336C5748C1A}.Debug|mac-x64.Build.0 = Debug|mac-x64 {1899C17C-1FA4-4807-B90E-0336C5748C1A}.Debug|mac-x64.Build.0 = Debug|mac-x64
{1899C17C-1FA4-4807-B90E-0336C5748C1A}.Debug|win-x64.ActiveCfg = Debug|win-x64 {1899C17C-1FA4-4807-B90E-0336C5748C1A}.Debug|win-x64.ActiveCfg = Debug|win-x64
+12 -4
View File
@@ -10,6 +10,7 @@ using Framework.Realm;
using Google.Protobuf; using Google.Protobuf;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
namespace BNetServer.Networking namespace BNetServer.Networking
@@ -92,11 +93,18 @@ namespace BNetServer.Networking
if (!IsOpen()) if (!IsOpen())
return; return;
var stream = new CodedInputStream(data, 0, receivedLength); int readPos = 0;
while (!stream.IsAtEnd) while (readPos < receivedLength)
{ {
var header = new Header(); var headerLength = (ushort)IPAddress.HostToNetworkOrder(BitConverter.ToInt16(data, readPos));
stream.ReadMessage(header); readPos += 2;
Header header = new();
header.MergeFrom(data, readPos, headerLength);
readPos += headerLength;
var stream = new CodedInputStream(data, readPos, (int)header.Size);
readPos += (int)header.Size;
if (header.ServiceId != 0xFE && header.ServiceHash != 0) if (header.ServiceId != 0xFE && header.ServiceHash != 0)
{ {
+1 -1
View File
@@ -5,7 +5,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Google.Protobuf" Version="4.0.0-rc2" /> <PackageReference Include="Google.Protobuf" Version="3.21.6" />
<PackageReference Include="MySqlConnector" Version="2.1.12" /> <PackageReference Include="MySqlConnector" Version="2.1.12" />
</ItemGroup> </ItemGroup>