(4f62d9b8f) Clients stop reading a network message if EventManager reports an error to the server. Otherwise the reading will fail with an "unknown object header" error, causing the client to disconnect themselves before receiving the more descriptive error message from the server.

This commit is contained in:
Joonas Rikkonen
2019-03-25 19:51:11 +02:00
parent 965a378f0e
commit eda3d9a533

View File

@@ -1400,6 +1400,7 @@ namespace Barotrauma.Networking
ServerNetObject objHeader;
while ((objHeader = (ServerNetObject)inc.ReadByte()) != ServerNetObject.END_OF_MESSAGE)
{
bool eventReadFailed = false;
switch (objHeader)
{
case ServerNetObject.SYNC_IDS:
@@ -1428,7 +1429,11 @@ namespace Barotrauma.Networking
break;
case ServerNetObject.ENTITY_EVENT:
case ServerNetObject.ENTITY_EVENT_INITIAL:
if (!entityEventManager.Read(objHeader, inc, sendingTime, entities)) { break; }
if (!entityEventManager.Read(objHeader, inc, sendingTime, entities))
{
eventReadFailed = true;
break;
}
break;
case ServerNetObject.CHAT_MESSAGE:
ChatMessage.ClientRead(inc);
@@ -1484,6 +1489,11 @@ namespace Barotrauma.Networking
prevObjHeader = objHeader;
prevBitPos = inc.Position;
prevBytePos = inc.PositionInBytes;
if (eventReadFailed)
{
break;
}
}
}