Skip to content

Commit

Permalink
Merge pull request #157 from tayloraswift/upgrade-nio-78
Browse files Browse the repository at this point in the history
upgrade to SwiftNIO 2.78
  • Loading branch information
tayloraswift authored Jan 16, 2025
2 parents bc7dd00 + 11631fb commit 3c45a43
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 36 deletions.
14 changes: 7 additions & 7 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "daceeee59031d65a8c33cfb323a21ded2a125f3bdc49c26d3e67bcbc4f71d180",
"originHash" : "2a316d3f318f7c8b6ff89b547e013115e2f4b4235e2e139d5b3828f9c599b8c7",
"pins" : [
{
"identity" : "swift-atomics",
Expand All @@ -15,8 +15,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/tayloraswift/swift-bson",
"state" : {
"revision" : "0fa7c4a61c509c78bcdc239f0185af188d9bc7da",
"version" : "0.9.0"
"revision" : "0d7c9735b726f931a67da00b836e8fd383f43cb3",
"version" : "1.0.0"
}
},
{
Expand All @@ -33,8 +33,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/tayloraswift/swift-grammar",
"state" : {
"revision" : "4b47a153732e0b094ef7dd95d891b37b7ae37a69",
"version" : "0.4.1"
"revision" : "0dac977b50bf677b2c3adabd7d5586a7b6e09b17",
"version" : "0.5.0"
}
},
{
Expand All @@ -51,8 +51,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio",
"state" : {
"revision" : "dca6594f65308c761a9c409e09fbf35f48d50d34",
"version" : "2.77.0"
"revision" : "ba72f31e11275fc5bf060c966cf6c1f36842a291",
"version" : "2.79.0"
}
},
{
Expand Down
26 changes: 9 additions & 17 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,15 @@ let package:Package = .init(name: "swift-mongodb",
.library(name: "UnixTime_Atomics", targets: ["UnixTime_Atomics"]),
],
dependencies: [
.package(url: "https://github.com/tayloraswift/swift-bson",
from: "0.9.0"),
.package(url: "https://github.com/tayloraswift/swift-grammar",
from: "0.4.0"),
.package(url: "https://github.com/tayloraswift/swift-hash",
from: "0.7.0"),
.package(url: "https://github.com/tayloraswift/swift-unixtime",
from: "0.1.5"),

.package(url: "https://github.com/apple/swift-atomics", .upToNextMinor(
from: "1.2.0")),
.package(url: "https://github.com/apple/swift-collections", .upToNextMinor(
from: "1.1.0")),

.package(url: "https://github.com/apple/swift-nio", "2.75.0" ..< "2.78.0"),
.package(url: "https://github.com/apple/swift-nio-ssl",
from: "2.28.0"),
.package(url: "https://github.com/tayloraswift/swift-bson", from: "1.0.0"),
.package(url: "https://github.com/tayloraswift/swift-grammar", from: "0.4.0"),
.package(url: "https://github.com/tayloraswift/swift-hash", from: "0.7.0"),
.package(url: "https://github.com/tayloraswift/swift-unixtime", from: "0.1.5"),

.package(url: "https://github.com/apple/swift-atomics", from: "1.2.0"),
.package(url: "https://github.com/apple/swift-collections", from: "1.1.0"),
.package(url: "https://github.com/apple/swift-nio", from: "2.79.0"),
.package(url: "https://github.com/apple/swift-nio-ssl", from: "2.28.0"),
],
targets: [
.target(name: "BSON_OrderedCollections",
Expand Down
28 changes: 16 additions & 12 deletions Sources/MongoDriver/Connections/Mongo.ConnectorFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,24 @@ extension Mongo.ConnectorFactory
{
(channel:any Channel) in

let parser:Mongo.WireMessageParser = .init()
let router:Mongo.WireMessageRouter = .init()

guard case .enabled = self.tls
else
{
return channel.pipeline.addHandlers(parser, router)
}
do
{
let tls:NIOSSLClientHandler = try .init(context: .init(
configuration: .clientDefault),
serverHostname: host.name)
return channel.pipeline.addHandlers(tls, parser, router)
let parser:Mongo.WireMessageParser = .init()
let router:Mongo.WireMessageRouter = .init()

switch self.tls
{
case .enabled:
let tls:NIOSSLClientHandler = try .init(context: .init(
configuration: .clientDefault),
serverHostname: host.name)
try channel.pipeline.syncOperations.addHandlers(tls, parser, router)

case .disabled:
try channel.pipeline.syncOperations.addHandlers(parser, router)
}

return channel.eventLoop.makeSucceededFuture(())
}
catch let error
{
Expand Down

0 comments on commit 3c45a43

Please sign in to comment.