mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Tests: nimoyd unbatcher repro
This commit is contained in:
parent
fb608d685a
commit
fe7ed2ace1
@ -21,6 +21,29 @@ public void GetNextMessage_NoBatches()
|
||||
Assert.That(result, Is.False);
|
||||
}
|
||||
|
||||
// test for nimoyd bug, where calling getnextmessage after the previous
|
||||
// call already returned false would cause an InvalidOperationException.
|
||||
[Test]
|
||||
public void GetNextMessage_NoBatches_AfterWeHadBatches()
|
||||
{
|
||||
// add batch
|
||||
byte[] batch = BatcherTests.ConcatTimestamp(TimeStamp, new byte[2]);
|
||||
unbatcher.AddBatch(new ArraySegment<byte>(batch));
|
||||
|
||||
// get next message, pretend we read the whole thing
|
||||
bool result = unbatcher.GetNextMessage(out NetworkReader reader, out _);
|
||||
Assert.That(result, Is.True);
|
||||
reader.Position = reader.Length;
|
||||
|
||||
// shouldn't get another one
|
||||
result = unbatcher.GetNextMessage(out reader, out _);
|
||||
Assert.That(result, Is.False);
|
||||
|
||||
// calling it again was causing "InvalidOperationException: Queue empty"
|
||||
result = unbatcher.GetNextMessage(out reader, out _);
|
||||
Assert.That(result, Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNextMessage_OneBatch()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user