Fixed servers failing to write network events for wires with too many nodes, causing clients syncing to fail and everyone getting kicked out due to desync. Now the wire events are split into multiple events, and there's a hard cap (255) on the number of nodes per wire. Closes #563

+ Writing too much data into an event no longer breaks event syncing completely, if it happens the server just logs an error and writes an empty event.
This commit is contained in:
Joonas Rikkonen
2018-08-03 21:32:28 +03:00
parent 2f5ca65542
commit a69c52b3c1
2 changed files with 63 additions and 27 deletions
@@ -55,6 +55,13 @@ namespace Barotrauma.Networking
GameAnalyticsManager.AddErrorEventOnce("NetEntityEventManager.Write:TooLong" + e.Entity.ToString(),
GameAnalyticsSDK.Net.EGAErrorSeverity.Error,
"Too much data in network event for entity \"" + e.Entity.ToString() + "\" (" + tempEventBuffer.LengthBytes + " bytes");
//write an empty event breaking the event syncing
tempBuffer.Write((UInt16)0);
tempBuffer.WritePadBits();
eventCount++;
continue;
}
//the ID has been taken by another entity (the original entity has been removed) -> write an empty event