summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-11-17 15:24:07 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-11-17 15:24:07 -0500
commitfb9ef6efda9ae9f59104c40b19fcb2daa6027297 (patch)
treeb8b2dafb939e1a66cdbbcb49ce9ee95b9f01666e
parent3a4ad38e05d1d403cff34d5717ad95df24df9b81 (diff)
downloadSMAPI-fb9ef6efda9ae9f59104c40b19fcb2daa6027297.tar.gz
SMAPI-fb9ef6efda9ae9f59104c40b19fcb2daa6027297.tar.bz2
SMAPI-fb9ef6efda9ae9f59104c40b19fcb2daa6027297.zip
fix errors in rare cases when sending a message through LidgrenClient after an error packet is received (#480)
-rw-r--r--src/SMAPI/Framework/Networking/SLidgrenServer.cs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/SMAPI/Framework/Networking/SLidgrenServer.cs b/src/SMAPI/Framework/Networking/SLidgrenServer.cs
index 37e546a1..251e5268 100644
--- a/src/SMAPI/Framework/Networking/SLidgrenServer.cs
+++ b/src/SMAPI/Framework/Networking/SLidgrenServer.cs
@@ -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);