mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Unbatcher: simplify GetNextMessage
This commit is contained in:
parent
54f6abb6ce
commit
581d16eb75
@ -90,22 +90,17 @@ public bool GetNextMessage(out NetworkReader message, out double remoteTimeStamp
|
||||
// ProcessMessage(message);
|
||||
//
|
||||
message = null;
|
||||
remoteTimeStamp = 0;
|
||||
|
||||
// do nothing if we don't have any batches.
|
||||
// otherwise the below queue.Dequeue() would throw an
|
||||
// InvalidOperationException if operating on empty queue.
|
||||
if (batches.Count == 0)
|
||||
{
|
||||
remoteTimeStamp = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// was our reader pointed to anything yet?
|
||||
if (reader.Capacity == 0)
|
||||
{
|
||||
remoteTimeStamp = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// no more data to read?
|
||||
if (reader.Remaining == 0)
|
||||
@ -123,11 +118,7 @@ public bool GetNextMessage(out NetworkReader message, out double remoteTimeStamp
|
||||
StartReadingBatch(next);
|
||||
}
|
||||
// otherwise there's nothing more to read
|
||||
else
|
||||
{
|
||||
remoteTimeStamp = 0;
|
||||
return false;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
// use the current batch's remote timestamp
|
||||
|
Loading…
Reference in New Issue
Block a user