1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 06:52:55 +08:00

Merge pull request #26333 from bdach/retry-perfect-unobserved-error

Fix possible double score submission when auto-retrying via perfect mod
This commit is contained in:
Dean Herbert 2024-01-03 13:02:38 +09:00 committed by GitHub
commit 4e7b1e1190
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,6 +41,7 @@ namespace osu.Game.Screens.Play
[Resolved]
private SessionStatics statics { get; set; }
private readonly object scoreSubmissionLock = new object();
private TaskCompletionSource<bool> scoreSubmissionSource;
protected SubmittingPlayer(PlayerConfiguration configuration = null)
@ -228,16 +229,19 @@ namespace osu.Game.Screens.Play
return Task.CompletedTask;
}
if (scoreSubmissionSource != null)
return scoreSubmissionSource.Task;
lock (scoreSubmissionLock)
{
if (scoreSubmissionSource != null)
return scoreSubmissionSource.Task;
scoreSubmissionSource = new TaskCompletionSource<bool>();
}
// if the user never hit anything, this score should not be counted in any way.
if (!score.ScoreInfo.Statistics.Any(s => s.Key.IsHit() && s.Value > 0))
return Task.CompletedTask;
Logger.Log($"Beginning score submission (token:{token.Value})...");
scoreSubmissionSource = new TaskCompletionSource<bool>();
var request = CreateSubmissionRequest(score, token.Value);
request.Success += s =>