Increased minimum midround sync timeout to 10 s, an extra check to make sure the server doesn't write position updates during midround syncing (because the entities may not exist client-side yet)

This commit is contained in:
Joonas Rikkonen
2018-08-14 13:28:56 +03:00
parent 8160abe109
commit 8233f3b8df
2 changed files with 4 additions and 3 deletions

View File

@@ -963,8 +963,9 @@ namespace Barotrauma.Networking
WriteChatMessages(outmsg, c);
//write as many position updates as the message can fit
while (outmsg.LengthBytes < config.MaximumTransmissionUnit - 20 &&
//write as many position updates as the message can fit (only after midround syncing is done)
while (!c.NeedsMidRoundSync &&
outmsg.LengthBytes < config.MaximumTransmissionUnit - 20 &&
c.PendingPositionUpdates.Count > 0)
{
var entity = c.PendingPositionUpdates.Dequeue();

View File

@@ -305,7 +305,7 @@ namespace Barotrauma.Networking
else
{
double midRoundSyncTimeOut = uniqueEvents.Count / MaxEventsPerWrite * server.UpdateInterval.TotalSeconds;
midRoundSyncTimeOut = Math.Max(5.0f, midRoundSyncTimeOut * 2.0f);
midRoundSyncTimeOut = Math.Max(10.0f, midRoundSyncTimeOut * 2.0f);
client.UnreceivedEntityEventCount = (UInt16)uniqueEvents.Count;
client.FirstNewEventID = 0;