Skip to content

Commit b015d0d

Browse files
committed
fix local sesssion dispose async
1 parent ccc959e commit b015d0d

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/Backdash/Session/Backends/LocalSession.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,9 @@ SessionServices<TInput> services
5555
this.options = options;
5656
}
5757

58-
public void Dispose() => tsc.SetResult();
58+
public void Dispose() => tsc.SetCanceled();
5959

60-
public async ValueTask DisposeAsync()
61-
{
62-
Dispose();
63-
await WaitUntilFinish();
64-
}
60+
public async ValueTask DisposeAsync() => await WaitUntilFinish();
6561

6662
public int NumberOfPlayers => Math.Max(addedPlayers.Count, 1);
6763
public int NumberOfSpectators => 0;
@@ -97,7 +93,7 @@ public void Start(CancellationToken stoppingToken = default)
9793
public async Task WaitUntilFinish(CancellationToken stoppingToken = default)
9894
{
9995
// ReSharper disable once MethodSupportsCancellation
100-
tsc.SetCanceled(stoppingToken);
96+
tsc.TrySetCanceled(stoppingToken);
10197
await backGroundJobTask.WaitAsync(stoppingToken).ConfigureAwait(false);
10298
}
10399

0 commit comments

Comments
 (0)