Skip to content

Commit

Permalink
Merge pull request Cysharp#476 from Cysharp/hotfix/IgnoreStreamRstOnS…
Browse files Browse the repository at this point in the history
…treamingHub2

Fix condition
  • Loading branch information
mayuki authored Nov 24, 2021
2 parents afec7f6 + 4599baf commit 6ce5183
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/MagicOnion.Server/Hubs/StreamingHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ public async Task<DuplexStreamingResult<byte[], byte[]>> Connect()
// NOTE: If DuplexStreaming is disconnected by the client, IOException will be thrown.
// However, such behavior is expected. the exception can be ignored.
}
catch (IOException ex)
catch (IOException)
{
// NOTE: If the connection closed with STREAM_RST, PipeReader throws an IOException.
// However, such behavior is expected. the exception can be ignored.
// https://github.com/dotnet/aspnetcore/blob/v6.0.0/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Stream.cs#L516-L523
var httpRequestLifetimeFeature = this.Context.ServiceProvider.GetService<IHttpContextAccessor>()?.HttpContext.Features.Get<IHttpRequestLifetimeFeature>();
if (httpRequestLifetimeFeature is null || httpRequestLifetimeFeature.RequestAborted.IsCancellationRequested)
var httpRequestLifetimeFeature = this.Context.ServiceProvider.GetService<IHttpContextAccessor>()?.HttpContext?.Features.Get<IHttpRequestLifetimeFeature>();
if (httpRequestLifetimeFeature is null || !httpRequestLifetimeFeature.RequestAborted.IsCancellationRequested)
{
throw;
}
Expand Down

0 comments on commit 6ce5183

Please sign in to comment.