]> git.deb.at Git - rhonda/impostor.hazel.git/commitdiff
Fix a very strange issue around the socket on message read callback potentially being...
authorForest <forest@innersloth.com>
Tue, 30 Mar 2021 07:21:53 +0000 (00:21 -0700)
committerForest <forest@innersloth.com>
Tue, 30 Mar 2021 07:21:53 +0000 (00:21 -0700)
Hazel/Udp/UnityUdpClientConnection.cs

index 422b28e3484f6f1dfedd1d3919024113c28de9f7..81d6d1bdd9533032c6296a36a8703606c92a6975 100644 (file)
@@ -229,6 +229,13 @@ namespace Hazel.Udp
                 DisconnectInternal(HazelInternalErrors.SocketExceptionReceive, "Socket exception while reading data: " + e.Message);
                 return;
             }
+            catch (ObjectDisposedException)
+            {
+                // Weirdly, it seems that this method can be called twice on the same AsyncState when object is disposed...
+                // So this just keeps us from hitting Duplicate Add errors at the risk of if this is a platform
+                // specific bug, we leak a MessageReader while the socket is disposing. Not a bad trade off.
+                return;
+            }
             catch (Exception)
             {
                 msg.Recycle();