@@ -155,11 +155,21 @@ public final class Server<RequestHandler: HTTPServerRequestHandler> {
155155 configuration: HTTPServerConfiguration ,
156156 handler: RequestHandler
157157 ) async throws {
158+ let asyncChannelConfiguration : NIOAsyncChannel < HTTPRequestPart , HTTPResponsePart > . Configuration
159+ switch configuration. backpressureStrategy. backing {
160+ case . watermark( let low, let high) :
161+ asyncChannelConfiguration = . init(
162+ backPressureStrategy: . init( lowWatermark: low, highWatermark: high) ,
163+ isOutboundHalfClosureEnabled: true
164+ )
165+ }
166+
158167 switch configuration. tlSConfiguration. backing {
159168 case . insecure:
160169 try await Self . serveInsecureHTTP1_1 (
161170 bindTarget: configuration. bindTarget,
162171 handler: handler,
172+ asyncChannelConfiguration: asyncChannelConfiguration,
163173 logger: logger
164174 )
165175
@@ -169,6 +179,7 @@ public final class Server<RequestHandler: HTTPServerRequestHandler> {
169179 certificateChain: certificateChain,
170180 privateKey: privateKey,
171181 handler: handler,
182+ asyncChannelConfiguration: asyncChannelConfiguration,
172183 logger: logger
173184 )
174185 }
@@ -177,6 +188,7 @@ public final class Server<RequestHandler: HTTPServerRequestHandler> {
177188 private static func serveInsecureHTTP1_1(
178189 bindTarget: HTTPServerConfiguration . BindTarget ,
179190 handler: RequestHandler ,
191+ asyncChannelConfiguration: NIOAsyncChannel < HTTPRequestPart , HTTPResponsePart > . Configuration ,
180192 logger: Logger
181193 ) async throws {
182194 switch bindTarget. backing {
@@ -188,7 +200,7 @@ public final class Server<RequestHandler: HTTPServerRequestHandler> {
188200 try channel. pipeline. syncOperations. addHandler ( HTTP1ToHTTPServerCodec ( secure: false ) )
189201 return try NIOAsyncChannel < HTTPRequestPart , HTTPResponsePart > (
190202 wrappingChannelSynchronously: channel,
191- configuration: . init ( isOutboundHalfClosureEnabled : true )
203+ configuration: asyncChannelConfiguration
192204 )
193205 }
194206 }
@@ -214,6 +226,7 @@ public final class Server<RequestHandler: HTTPServerRequestHandler> {
214226 certificateChain: [ Certificate ] ,
215227 privateKey: Certificate . PrivateKey ,
216228 handler: RequestHandler ,
229+ asyncChannelConfiguration: NIOAsyncChannel < HTTPRequestPart , HTTPResponsePart > . Configuration ,
217230 logger: Logger
218231 ) async throws {
219232 switch bindTarget. backing {
@@ -256,7 +269,7 @@ public final class Server<RequestHandler: HTTPServerRequestHandler> {
256269
257270 return try NIOAsyncChannel < HTTPRequestPart , HTTPResponsePart > (
258271 wrappingChannelSynchronously: channel,
259- configuration: . init ( isOutboundHalfClosureEnabled : true )
272+ configuration: asyncChannelConfiguration
260273 )
261274 }
262275 } http2ConnectionInitializer: { channel in
@@ -270,7 +283,7 @@ public final class Server<RequestHandler: HTTPServerRequestHandler> {
270283
271284 return try NIOAsyncChannel < HTTPRequestPart , HTTPResponsePart > (
272285 wrappingChannelSynchronously: channel,
273- configuration: . init ( isOutboundHalfClosureEnabled : true )
286+ configuration: asyncChannelConfiguration
274287 )
275288 }
276289 }
0 commit comments