Skip to content

Commit

Permalink
Disable packet merging temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksonrakena committed Dec 2, 2023
1 parent 5405e85 commit b4f50d1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Common/Networking/Data/CompositeReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal static CompositeReader Create(ArraySegment<byte> data)

public static implicit operator ArraySegment<byte>(CompositeReader cmpw)
{
return new ArraySegment<byte>(cmpw._ms.GetBuffer(), 0, (int)cmpw._ms.Length);
return cmpw._data;
}
}
}
18 changes: 9 additions & 9 deletions Common/Networking/Peers/PeerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -662,18 +662,18 @@ internal async Task SendUserData(NetworkPacket packet)
packet.ConnectionNumber = _connectNumber;
int mergedPacketSize = NetConstants.HeaderSize + packet.Data.Count + 2;
const int splitThreshold = 20;
if (mergedPacketSize + splitThreshold >= MaximumTransferUnit)
{
//if (mergedPacketSize + splitThreshold >= MaximumTransferUnit)
//{
NetDebug.Write("[P]SendingPacket: " + packet.Property);
await PromulManager.RawSendAsync(packet, EndPoint);
return;
}
if (_mergePos + mergedPacketSize > MaximumTransferUnit) await SendMerged();

FastBitConverter.GetBytes(_mergeData.Data.Array, _mergeData.Data.Offset+_mergePos + NetConstants.HeaderSize, (ushort)packet.Data.Count);
packet.Data.CopyTo(_mergeData.Data.Array, _mergeData.Data.Offset+_mergePos+NetConstants.HeaderSize+2);
_mergePos += packet.Data.Count + 2;
_mergeCount++;
//}
// if (_mergePos + mergedPacketSize > MaximumTransferUnit) await SendMerged();
//
// FastBitConverter.GetBytes(_mergeData.Data.Array, _mergeData.Data.Offset+_mergePos + NetConstants.HeaderSize, (ushort)packet.Data.Count);
// packet.Data.CopyTo(_mergeData.Data.Array, _mergeData.Data.Offset+_mergePos+NetConstants.HeaderSize+2);
// _mergePos += packet.Data.Count + 2;
// _mergeCount++;
}

private async Task SendMerged()
Expand Down
2 changes: 1 addition & 1 deletion Runtime/PromulTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public async Task SendControl(RelayControlMessage rcm, NetworkDelivery qos)

public override void Send(ulong clientId, ArraySegment<byte> data, NetworkDelivery qos)
{
Debug.Log("Sending: " + string.Join(" ", data.Select(e => e.ToString("X"))));
Debug.Log("Sending to " + clientId + ": " + string.Join(" ", data.Select(e => e.ToString("X2"))));
Task.Run(async () =>
{
await SendControl(new RelayControlMessage
Expand Down

0 comments on commit b4f50d1

Please sign in to comment.