From cda8029edb15bf6b9365c3cd8edf7f29b03ce535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20He=C3=9F?= Date: Sat, 14 Dec 2024 16:54:05 +0100 Subject: [PATCH 1/2] Add `.editorconfig` Nice... --- .editorconfig | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..0957abb --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +[*] +indent_style = space +indent_size = 2 +tab_width = 8 +max_line_length = 80 +trim_trailing_whitespace = false +end_of_line = lf +insert_final_newline = true From 60cb596bdf7c3ad34218ca77216d40260d307287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20He=C3=9F?= Date: Fri, 20 Dec 2024 12:54:46 +0100 Subject: [PATCH 2/2] Do not emit ECONNRESET error when there is no transaction It is just a long running HTTP close. --- Sources/http/Server/Server.swift | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Sources/http/Server/Server.swift b/Sources/http/Server/Server.swift index 843911f..aa51a8b 100644 --- a/Sources/http/Server/Server.swift +++ b/Sources/http/Server/Server.swift @@ -546,21 +546,17 @@ open class Server: ErrorEmitter, CustomStringConvertible { server.emitError(error, transaction: ( request, response )) self.transaction = nil } - else { + else { // We are not in a transaction. ECONNRESET is not an error. assert(transaction == nil) - var doError = true if let error = error as? IOError, error.errnoCode == ECONNRESET { - doError = false - } - - if doError { - server.log.error("HTTP error, closing connection: \(error)") + server.log.trace("HTTP ECONNRESET, closing connection: \(error)") + // Do not emit ECONNRESET } else { - server.log.trace("HTTP error, closing connection: \(error)") + server.log.error("HTTP error, closing connection: \(error)") + server.emitError(error, transaction: nil) } - server.emitError(error, transaction: nil) } context.close(promise: nil) }