mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 09:27:18 +09:00
Handle task exception outside of schedule to avoid unobserved exceptions
This commit is contained in:
parent
a2701a3205
commit
22b254e5c5
@ -294,17 +294,21 @@ namespace osu.Game.Online.Spectator
|
|||||||
|
|
||||||
lastSend = tcs.Task;
|
lastSend = tcs.Task;
|
||||||
|
|
||||||
SendFramesInternal(bundle).ContinueWith(t => Schedule(() =>
|
SendFramesInternal(bundle).ContinueWith(t =>
|
||||||
{
|
{
|
||||||
|
// Handle exception outside of `Schedule` to ensure it doesn't go unovserved.
|
||||||
bool wasSuccessful = t.Exception == null;
|
bool wasSuccessful = t.Exception == null;
|
||||||
|
|
||||||
// If the last bundle send wasn't successful, try again without dequeuing.
|
return Schedule(() =>
|
||||||
if (wasSuccessful)
|
{
|
||||||
pendingFrameBundles.Dequeue();
|
// If the last bundle send wasn't successful, try again without dequeuing.
|
||||||
|
if (wasSuccessful)
|
||||||
|
pendingFrameBundles.Dequeue();
|
||||||
|
|
||||||
tcs.SetResult(wasSuccessful);
|
tcs.SetResult(wasSuccessful);
|
||||||
sendNextBundleIfRequired();
|
sendNextBundleIfRequired();
|
||||||
}));
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user