Unreliable fragments cause "Packet header indicates non-fragment packet" error
When receiving unreliable message fragments an exception is thrown in PacketIO. ReadFragmentHeader.
This seems to work as intended when sending with QoSType.Reliable, but fails with QoSType.Unreliable. Haven't tried QoSType.UnreliableOrdered. Is fragmentation not supported for unreliable packets?
To reproduce:
ReliableEndpoint endpoint1 = new ReliableEndpoint();
ReliableEndpoint endpoint2 = new ReliableEndpoint();
endpoint1.TransmitCallback = (payload, size) =>
{
endpoint2.ReceivePacket(payload, size);
};
endpoint1.ReceiveCallback = (payload, size) =>
{
Console.WriteLine("endpoint1 received {0} bytes", size);
};
endpoint2.TransmitCallback = (payload, size) =>
{
endpoint1.ReceivePacket(payload, size);
};
endpoint2.ReceiveCallback = (payload, size) =>
{
Console.WriteLine("endpoint2 received {0} bytes", size);
};
byte[] data = new byte[5120];
new Random().NextBytes(data);
endpoint1.SendMessage(data, data.Length, QosType.Unreliable);
Ah, fragmentation is not supported for unreliable fragments, but that does seem like poor failure behavior (ideally, it should be failing with a more descriptive error message when you attempt to send a packet that's too large rather than failing on the receiving end with a somewhat cryptic message like that).
@KillaMaaki Thanks, I can work with that.
Perhaps as a start the unreliable message channel config should be tweaked to indicate max message size 1024 and max fragments 1 here?