mirror of
https://github.com/ppy/osu.git
synced 2025-03-15 15:27:20 +08: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;
|
||||
|
||||
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;
|
||||
|
||||
// If the last bundle send wasn't successful, try again without dequeuing.
|
||||
if (wasSuccessful)
|
||||
pendingFrameBundles.Dequeue();
|
||||
return Schedule(() =>
|
||||
{
|
||||
// If the last bundle send wasn't successful, try again without dequeuing.
|
||||
if (wasSuccessful)
|
||||
pendingFrameBundles.Dequeue();
|
||||
|
||||
tcs.SetResult(wasSuccessful);
|
||||
sendNextBundleIfRequired();
|
||||
}));
|
||||
tcs.SetResult(wasSuccessful);
|
||||
sendNextBundleIfRequired();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user