mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkServerTests: MaxMessageSize
This commit is contained in:
parent
e78304c465
commit
4703c5e939
@ -355,6 +355,28 @@ public void Send_ServerToClientMessage()
|
||||
Assert.That(called, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
// guarantee that exactly max packet size messages work
|
||||
[Test]
|
||||
public void Send_ClientToServerMessage_MaxMessageSize()
|
||||
{
|
||||
// register a message handler
|
||||
int called = 0;
|
||||
NetworkServer.RegisterHandler<VariableSizedMessage>((conn, msg) => ++called, false);
|
||||
|
||||
// listen & connect a client
|
||||
NetworkServer.Listen(1);
|
||||
ConnectClientBlocking(out _);
|
||||
|
||||
// send message & process
|
||||
int transportMax = transport.GetMaxPacketSize(Channels.Reliable);
|
||||
int messageMax = transportMax - MessagePacking.HeaderSize;
|
||||
NetworkClient.Send(new VariableSizedMessage(messageMax));
|
||||
ProcessMessages();
|
||||
|
||||
// did it get through?
|
||||
Assert.That(called, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
// transport recommends a max batch size.
|
||||
// but we support up to max packet size.
|
||||
// for example, with KCP it makes sense to always send MTU sized batches.
|
||||
|
Loading…
Reference in New Issue
Block a user