fix errors in rare cases when sending a message through LidgrenClient after an error packet is received (#480)

This commit is contained in:
Jesse Plamondon-Willard 2018-11-17 15:24:07 -05:00
parent 3a4ad38e05
commit fb9ef6efda
No known key found for this signature in database
GPG Key ID: 7D7C8097B62033CE
1 changed files with 2 additions and 1 deletions

View File

@ -47,7 +47,8 @@ namespace StardewModdingAPI.Framework.Networking
while (rawMessage.LengthBits - rawMessage.Position >= 8)
{
message.Read(reader);
this.OnProcessingMessage(message, outgoing => this.sendMessage(rawMessage.SenderConnection, outgoing), () =>
NetConnection connection = rawMessage.SenderConnection; // don't pass rawMessage into context because it gets reused
this.OnProcessingMessage(message, outgoing => this.sendMessage(connection, outgoing), () =>
{
if (this.peers.ContainsLeft(message.FarmerID) && this.peers[message.FarmerID] == peer)
this.gameServer.processIncomingMessage(message);