Skip to content

Commit e9d6160

Browse files
authored
Merge pull request #399 from tayloraswift/upgrade-nio
Upgrade SwiftNIO to 2.79.0
2 parents a1a483a + 2b5ed3f commit e9d6160

36 files changed

+1379
-128
lines changed

Package.resolved

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,21 @@ let package:Package = .init(
7979
],
8080
dependencies: [
8181
.package(url: "https://github.com/tayloraswift/swift-bson", .upToNextMinor(
82-
from: "0.9.0")),
82+
from: "1.0.0")),
8383
.package(url: "https://github.com/tayloraswift/swift-dom", .upToNextMinor(
8484
from: "1.1.0")),
8585
.package(url: "https://github.com/tayloraswift/swift-grammar", .upToNextMinor(
86-
from: "0.4.0")),
86+
from: "0.5.0")),
8787
.package(url: "https://github.com/tayloraswift/swift-hash", .upToNextMinor(
8888
from: "0.7.1")),
8989
.package(url: "https://github.com/tayloraswift/swift-ip", .upToNextMinor(
90-
from: "0.3.2")),
90+
from: "0.3.3")),
9191
.package(url: "https://github.com/tayloraswift/swift-json", .upToNextMinor(
92-
from: "1.1.0")),
92+
from: "1.1.2")),
9393
.package(url: "https://github.com/tayloraswift/swift-mongodb", .upToNextMinor(
94-
from: "0.29.1")),
94+
from: "0.29.2")),
9595
.package(url: "https://github.com/tayloraswift/swift-png", .upToNextMinor(
96-
from: "4.4.8")),
96+
from: "4.4.9")),
9797
.package(url: "https://github.com/tayloraswift/swift-ucf", .upToNextMinor(
9898
from: "0.1.0")),
9999
.package(url: "https://github.com/tayloraswift/swift-unixtime", .upToNextMinor(
@@ -107,10 +107,8 @@ let package:Package = .init(
107107
.package(url: "https://github.com/apple/swift-collections", .upToNextMinor(
108108
from: "1.1.1")),
109109

110-
.package(url: "https://github.com/apple/swift-nio",
111-
from: "2.68.0"),
112-
.package(url: "https://github.com/apple/swift-nio-ssl",
113-
from: "2.27.0"),
110+
.package(url: "https://github.com/apple/swift-nio", from: "2.79.0"),
111+
.package(url: "https://github.com/apple/swift-nio-ssl", from: "2.27.0"),
114112

115113
.package(url: "https://github.com/apple/swift-nio-http2", .upToNextMinor(
116114
from: "1.33.0")),
@@ -442,6 +440,11 @@ let package:Package = .init(
442440

443441
.target(name: "TopologicalSorting"),
444442

443+
.target(name: "Testing_",
444+
dependencies: [
445+
.product(name: "Atomics", package: "swift-atomics"),
446+
]),
447+
445448
.target(name: "UA",
446449
dependencies: [
447450
.product(name: "Grammar", package: "swift-grammar"),
@@ -628,19 +631,19 @@ let package:Package = .init(
628631
dependencies: [
629632
.target(name: "PackageMetadata"),
630633
.target(name: "System_"),
631-
.product(name: "Testing_", package: "swift-grammar"),
634+
.target(name: "Testing_"),
632635
]),
633636

634637
.executableTarget(name: "S3Tests",
635638
dependencies: [
636639
.target(name: "S3Client"),
637-
.product(name: "Testing_", package: "swift-grammar"),
640+
.target(name: "Testing_"),
638641
]),
639642

640643
.executableTarget(name: "SemanticVersionTests",
641644
dependencies: [
642645
.target(name: "SemanticVersions"),
643-
.product(name: "Testing_", package: "swift-grammar"),
646+
.target(name: "Testing_"),
644647
]),
645648

646649
.testTarget(name: "SymbolGraphValidationTests",
@@ -652,13 +655,13 @@ let package:Package = .init(
652655
.executableTarget(name: "SymbolGraphBuilderTests",
653656
dependencies: [
654657
.target(name: "SymbolGraphBuilder"),
655-
.product(name: "Testing_", package: "swift-grammar"),
658+
.target(name: "Testing_"),
656659
]),
657660

658661
.executableTarget(name: "SymbolGraphCompilerTests",
659662
dependencies: [
660663
.target(name: "SymbolGraphBuilder"),
661-
.product(name: "Testing_", package: "swift-grammar"),
664+
.target(name: "Testing_"),
662665
]),
663666

664667
.testTarget(name: "SymbolGraphLinkerTests",
@@ -671,25 +674,25 @@ let package:Package = .init(
671674
dependencies: [
672675
.target(name: "SymbolGraphParts"),
673676
.target(name: "System_"),
674-
.product(name: "Testing_", package: "swift-grammar"),
677+
.target(name: "Testing_"),
675678
]),
676679

677680
.executableTarget(name: "SymbolGraphTests",
678681
dependencies: [
679682
.target(name: "SymbolGraphs"),
680-
.product(name: "Testing_", package: "swift-grammar"),
683+
.target(name: "Testing_"),
681684
]),
682685

683686
.executableTarget(name: "SymbolTests",
684687
dependencies: [
685688
.target(name: "Symbols"),
686-
.product(name: "Testing_", package: "swift-grammar"),
689+
.target(name: "Testing_"),
687690
]),
688691

689692
.executableTarget(name: "SystemTests",
690693
dependencies: [
691694
.target(name: "System_"),
692-
.product(name: "Testing_", package: "swift-grammar"),
695+
.target(name: "Testing_"),
693696
],
694697
exclude:
695698
[
@@ -698,14 +701,14 @@ let package:Package = .init(
698701

699702
.executableTarget(name: "TopologicalSortingTests",
700703
dependencies: [
704+
.target(name: "Testing_"),
701705
.target(name: "TopologicalSorting"),
702-
.product(name: "Testing_", package: "swift-grammar"),
703706
]),
704707

705708
.executableTarget(name: "UATests",
706709
dependencies: [
710+
.target(name: "Testing_"),
707711
.target(name: "UA"),
708-
.product(name: "Testing_", package: "swift-grammar"),
709712
]),
710713

711714
.testTarget(name: "UnidocDBTests",

Sources/HTTPClient/HTTP1/HTTP.Client1.swift

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,35 +34,17 @@ extension HTTP.Client1
3434
{
3535
(channel:any Channel) in
3636

37-
guard
38-
let niossl:NIOSSLContext
39-
else
37+
channel.eventLoop.makeCompletedFuture
4038
{
41-
return channel.pipeline.addHTTPClientHandlers()
42-
.flatMap
39+
if let niossl:NIOSSLContext
4340
{
44-
channel.pipeline.addHandler(InterfaceHandler.init())
41+
let tlsHandler:NIOSSLClientHandler = try .init(context: niossl,
42+
serverHostname: remote)
43+
try channel.pipeline.syncOperations.addHandler(tlsHandler)
4544
}
46-
}
47-
48-
do
49-
{
50-
let tls:NIOSSLClientHandler = try .init(context: niossl,
51-
serverHostname: remote)
5245

53-
return channel.pipeline.addHandler(tls)
54-
.flatMap
55-
{
56-
channel.pipeline.addHTTPClientHandlers()
57-
.flatMap
58-
{
59-
channel.pipeline.addHandler(InterfaceHandler.init())
60-
}
61-
}
62-
}
63-
catch let error
64-
{
65-
return channel.eventLoop.makeFailedFuture(error)
46+
try channel.pipeline.syncOperations.addHTTPClientHandlers()
47+
try channel.pipeline.syncOperations.addHandler(InterfaceHandler.init())
6648
}
6749
}
6850

Sources/HTTPClient/HTTP2/HTTP.Client2.InterfaceHandler.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ extension HTTP.Client2.InterfaceHandler:ChannelOutboundHandler
6565
{
6666
self.multiplexer.createStreamChannel
6767
{
68-
$0.pipeline.addHandler(HTTP.Client2.StreamHandler.init(owner: owner))
68+
(channel:any Channel) in channel.eventLoop.makeCompletedFuture
69+
{
70+
try channel.pipeline.syncOperations.addHandler(
71+
HTTP.Client2.StreamHandler.init(owner: owner))
72+
}
6973
}
7074
.whenComplete
7175
{

Sources/HTTPClient/HTTP2/HTTP.Client2.swift

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,36 +35,30 @@ extension HTTP.Client2
3535
.connectTimeout(.seconds(3))
3636
.channelInitializer
3737
{
38-
(channel:any Channel) in
39-
40-
do
38+
(channel:any Channel) in channel.eventLoop.makeCompletedFuture
4139
{
42-
let tls:NIOSSLClientHandler = try .init(context: niossl,
40+
let tlsHandler:NIOSSLClientHandler = try .init(context: niossl,
4341
serverHostname: remote)
42+
let multiplexer:NIOHTTP2Handler.StreamMultiplexer
43+
44+
try channel.pipeline.syncOperations.addHandler(tlsHandler)
4445

45-
return channel.pipeline.addHandler(tls)
46-
.flatMap
46+
multiplexer = try channel.pipeline.syncOperations.configureHTTP2Pipeline(
47+
mode: .client,
48+
connectionConfiguration: .init(),
49+
streamConfiguration: .init())
4750
{
48-
channel.configureHTTP2Pipeline(mode: .client,
49-
connectionConfiguration: .init(),
50-
streamConfiguration: .init())
51+
(channel:any Channel) in channel.eventLoop.makeCompletedFuture
5152
{
5253
// With no owner, the stream is unsolicited and will drop any
5354
// responses it receives.
54-
$0.pipeline.addHandler(StreamHandler.init(owner: nil))
55-
}
56-
.flatMap
57-
{
58-
(multiplexer:NIOHTTP2Handler.StreamMultiplexer) in
59-
60-
channel.pipeline.addHandler(InterfaceHandler.init(
61-
multiplexer: multiplexer))
55+
try channel.pipeline.syncOperations.addHandler(StreamHandler.init(
56+
owner: nil))
6257
}
6358
}
64-
}
65-
catch let error
66-
{
67-
return channel.eventLoop.makeFailedFuture(error)
59+
60+
try channel.pipeline.syncOperations.addHandler(InterfaceHandler.init(
61+
multiplexer: multiplexer))
6862
}
6963
}
7064

0 commit comments

Comments
 (0)