-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: accepted network clients are disposed twice causing the server t…
…o throw already disposed exceptions when disconnecting
- Loading branch information
Fredrik Arvidsson
committed
Aug 16, 2021
1 parent
edd8903
commit fdc237b
Showing
5 changed files
with
49 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Port.Server.Framework | ||
{ | ||
internal static class AsyncDisposableExtensions | ||
{ | ||
internal static Task DisposeAllAsync( | ||
this IEnumerable<IAsyncDisposable> disposables) | ||
=> disposables.Select(client => client.DisposeAsync()) | ||
.WhenAllAsync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Port.Server.Framework | ||
{ | ||
internal static class ValueTaskExtensions | ||
{ | ||
internal static Task WhenAllAsync( | ||
this IEnumerable<ValueTask> tasks) | ||
=> Task.WhenAll( | ||
tasks.Where( | ||
valueTask | ||
=> !valueTask.IsCompletedSuccessfully) | ||
.Select(valueTask => valueTask.AsTask())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters