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 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) }