diff --git a/Package.swift b/Package.swift index 59a3e03a5..a4cc4dfb1 100644 --- a/Package.swift +++ b/Package.swift @@ -319,7 +319,8 @@ let package = Package( "NIOHTTP1", "NIOConcurrencyHelpers", ], - exclude: ["README.md"] + exclude: ["README.md"], + swiftSettings: strictConcurrencySettings ), .executableTarget( name: "NIOHTTP1Client", diff --git a/Sources/NIOHTTP1Client/main.swift b/Sources/NIOHTTP1Client/main.swift index 31a058bbe..41dece232 100644 --- a/Sources/NIOHTTP1Client/main.swift +++ b/Sources/NIOHTTP1Client/main.swift @@ -81,11 +81,12 @@ let bootstrap = ClientBootstrap(group: group) // Enable SO_REUSEADDR. .channelOption(.socketOption(.so_reuseaddr), value: 1) .channelInitializer { channel in - channel.pipeline.addHTTPClientHandlers( - position: .first, - leftOverBytesStrategy: .fireError - ).flatMap { - channel.pipeline.addHandler(HTTPEchoHandler()) + channel.eventLoop.makeCompletedFuture { + try channel.pipeline.syncOperations.addHTTPClientHandlers( + position: .first, + leftOverBytesStrategy: .fireError + ) + try channel.pipeline.syncOperations.addHandler(HTTPEchoHandler()) } } defer { diff --git a/Sources/NIOHTTP1Server/main.swift b/Sources/NIOHTTP1Server/main.swift index d3b6ce133..ac1752e8d 100644 --- a/Sources/NIOHTTP1Server/main.swift +++ b/Sources/NIOHTTP1Server/main.swift @@ -631,8 +631,8 @@ default: } func childChannelInitializer(channel: Channel) -> EventLoopFuture { - channel.pipeline.configureHTTPServerPipeline(withErrorHandling: true).flatMap { - channel.pipeline.addHandler(HTTPHandler(fileIO: fileIO, htdocsPath: htdocs)) + channel.pipeline.configureHTTPServerPipeline(withErrorHandling: true).flatMapThrowing { + try channel.pipeline.syncOperations.addHandler(HTTPHandler(fileIO: fileIO, htdocsPath: htdocs)) } }