Skip to content

Commit

Permalink
ignore more exceptions in KestrelPipeConnection
Browse files Browse the repository at this point in the history
  • Loading branch information
kerryjiang committed May 11, 2024
1 parent c810d30 commit 07f19a5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/SuperSocket.Kestrel/KestrelPipeConnection.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
namespace SuperSocket.Kestrel;

using System;
using System.IO;
using System.IO.Pipelines;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Connections;
Expand Down Expand Up @@ -73,6 +75,21 @@ public override async ValueTask SendAsync<TPackage>(IPackageEncoder<TPackage> pa
UpdateLastActiveTime();
}

protected override bool IsIgnorableException(Exception e)
{
if (e is IOException ioe && ioe.InnerException != null)
{
return IsIgnorableException(ioe.InnerException);
}

if (e is SocketException se)
{
return se.IsIgnorableSocketException();
}

return base.IsIgnorableException(e);
}

private void OnConnectionClosed()
{
Cancel();
Expand Down

0 comments on commit 07f19a5

Please sign in to comment.