Catch exception on shutdown

This commit is contained in:
GHXX 2024-01-13 03:14:10 +01:00
parent 09fa3b8734
commit a2a70e8339

View File

@ -46,6 +46,7 @@ public sealed class HttpServer {
try { try {
var ctx = await listener.GetContextAsync(); var ctx = await listener.GetContextAsync();
_ = ProcessRequestAsync(ctx); _ = ProcessRequestAsync(ctx);
} catch (HttpListenerException ex) when (ex.ErrorCode == 995) { //The I/O operation has been aborted because of either a thread exit or an application request
} catch (Exception ex) { } catch (Exception ex) {
logger.Fatal($"Caught otherwise uncaught exception in GetContextLoop:\n{ex}"); logger.Fatal($"Caught otherwise uncaught exception in GetContextLoop:\n{ex}");
} }