Skip to content

Commit

Permalink
Pre-emptively fix sendability issues with the next NIO release (#26)
Browse files Browse the repository at this point in the history
Motivation:

The next NIO release includes stricter sendability checks which result
in compilation errors in Swift 6 language mode.

Modifications:

- Change where a handler is constructed

Result:

Compiles with the SwiftNIO on main
  • Loading branch information
glbrntt authored Nov 8, 2024
1 parent 237bcc4 commit eebfb24
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,12 @@ extension HTTP2ServerTransport {
let serverChannel = try await ServerBootstrap(group: eventLoopGroup)
.serverChannelOption(.socketOption(.so_reuseaddr), value: 1)
.serverChannelInitializer { channel in
let quiescingHandler = serverQuiescingHelper.makeServerChannelHandler(channel: channel)
return channel.pipeline.addHandler(quiescingHandler)
return channel.eventLoop.makeCompletedFuture {
let quiescingHandler = serverQuiescingHelper.makeServerChannelHandler(
channel: channel
)
return try channel.pipeline.syncOperations.addHandler(quiescingHandler)
}
}
.bind(to: address) { channel in
channel.eventLoop.makeCompletedFuture {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ extension HTTP2ServerTransport {
try await bootstrap
.serverChannelOption(.socketOption(.so_reuseaddr), value: 1)
.serverChannelInitializer { channel in
let quiescingHandler = serverQuiescingHelper.makeServerChannelHandler(channel: channel)
return channel.pipeline.addHandler(quiescingHandler)
return channel.eventLoop.makeCompletedFuture {
let quiescingHandler = serverQuiescingHelper.makeServerChannelHandler(
channel: channel
)
return try channel.pipeline.syncOperations.addHandler(quiescingHandler)
}
}
.bind(to: address) { channel in
channel.eventLoop.makeCompletedFuture {
Expand Down

0 comments on commit eebfb24

Please sign in to comment.