[Modify] Lock it

This commit is contained in:
sta 2021-05-26 16:53:48 +09:00
parent 41d89493a5
commit b4c82165c6

View File

@ -822,6 +822,7 @@ namespace WebSocketSharp.Net
throw new ArgumentException (msg, "asyncResult"); throw new ArgumentException (msg, "asyncResult");
} }
lock (ares.SyncRoot) {
if (ares.EndCalled) { if (ares.EndCalled) {
var msg = "This IAsyncResult instance cannot be reused."; var msg = "This IAsyncResult instance cannot be reused.";
@ -829,6 +830,7 @@ namespace WebSocketSharp.Net
} }
ares.EndCalled = true; ares.EndCalled = true;
}
if (!ares.IsCompleted) if (!ares.IsCompleted)
ares.AsyncWaitHandle.WaitOne (); ares.AsyncWaitHandle.WaitOne ();