Skip to content

Commit

Permalink
Uses port from SRVRecord (#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejpiotrowski89 committed Oct 19, 2023
1 parent a85a674 commit f05069c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/MongoClient/Cluster.swift
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public final class MongoCluster: MongoConnectionPool, @unchecked Sendable {
private func resolveSRV(_ host: ConnectionSettings.Host, on client: DNSClient) async throws -> [ConnectionSettings.Host] {
let prefix = "_mongodb._tcp."
return try await client.getSRVRecords(from: prefix + host.hostname).get().map { record in
return ConnectionSettings.Host(hostname: record.resource.domainName.string, port: host.port)
return ConnectionSettings.Host(hostname: record.resource.domainName.string, port: Int(record.resource.port))
}
}

Expand Down

0 comments on commit f05069c

Please sign in to comment.