From 07f19a50798b43344a2fa6c345e0889cf8ae834d Mon Sep 17 00:00:00 2001 From: Kerry Jiang Date: Sat, 11 May 2024 11:15:25 -0700 Subject: [PATCH] ignore more exceptions in KestrelPipeConnection --- .../KestrelPipeConnection.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/SuperSocket.Kestrel/KestrelPipeConnection.cs b/src/SuperSocket.Kestrel/KestrelPipeConnection.cs index 253a9ccda..8ed40dd93 100644 --- a/src/SuperSocket.Kestrel/KestrelPipeConnection.cs +++ b/src/SuperSocket.Kestrel/KestrelPipeConnection.cs @@ -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; @@ -73,6 +75,21 @@ public override async ValueTask SendAsync(IPackageEncoder 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();