mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-08-21 21:33:01 +00:00
Make socket ConnectionLost run in a separate task to prevent issue with long running/exceptions in the handler
This commit is contained in:
@@ -301,7 +301,7 @@ namespace CryptoExchange.Net.Sockets
|
|||||||
if (!lostTriggered)
|
if (!lostTriggered)
|
||||||
{
|
{
|
||||||
lostTriggered = true;
|
lostTriggered = true;
|
||||||
ConnectionLost?.Invoke();
|
_ = Task.Run(() => ConnectionLost?.Invoke());
|
||||||
}
|
}
|
||||||
|
|
||||||
while (ShouldReconnect)
|
while (ShouldReconnect)
|
||||||
@@ -390,7 +390,7 @@ namespace CryptoExchange.Net.Sockets
|
|||||||
if (lostTriggered)
|
if (lostTriggered)
|
||||||
{
|
{
|
||||||
lostTriggered = false;
|
lostTriggered = false;
|
||||||
_ = Task.Run(() => ConnectionRestored?.Invoke(time.HasValue ? DateTime.UtcNow - time.Value : TimeSpan.FromSeconds(0))).ConfigureAwait(false);
|
_ = Task.Run(() => ConnectionRestored?.Invoke(time.HasValue ? DateTime.UtcNow - time.Value : TimeSpan.FromSeconds(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user