Call param configurator when wrapping an existing NWConnection

This commit is contained in:
Gus Cairo 2025-04-14 14:18:30 +01:00
parent 9e6e4ed7ab
commit 08a31ceb2f
3 changed files with 5 additions and 2 deletions

View File

@ -140,7 +140,7 @@ internal final class NIOTSDatagramChannel: StateManagedNWConnectionChannel {
internal var allowLocalEndpointReuse = false
internal var multipathServiceType: NWParameters.MultipathServiceType = .disabled
private let nwParametersConfigurator: (@Sendable (NWParameters) -> Void)?
internal let nwParametersConfigurator: (@Sendable (NWParameters) -> Void)?
var parameters: NWParameters {
let parameters = NWParameters(dtls: self.tlsOptions, udp: self.udpOptions)

View File

@ -164,7 +164,7 @@ internal final class NIOTSConnectionChannel: StateManagedNWConnectionChannel {
/// An `EventLoopPromise` that will be succeeded or failed when a connection attempt succeeds or fails.
internal var connectPromise: EventLoopPromise<Void>?
private let nwParametersConfigurator: (@Sendable (NWParameters) -> Void)?
internal let nwParametersConfigurator: (@Sendable (NWParameters) -> Void)?
internal var parameters: NWParameters {
let parameters = NWParameters(tls: self.tlsOptions, tcp: self.tcpOptions)

View File

@ -83,6 +83,8 @@ internal protocol StateManagedNWConnectionChannel: StateManagedChannel where Act
var multipathServiceType: NWParameters.MultipathServiceType { get }
var nwParametersConfigurator: (@Sendable (NWParameters) -> Void)? { get }
func setChannelSpecificOption0<Option: ChannelOption>(option: Option, value: Option.Value) throws
func getChannelSpecificOption0<Option: ChannelOption>(option: Option) throws -> Option.Value
@ -242,6 +244,7 @@ extension StateManagedNWConnectionChannel {
connection.betterPathUpdateHandler = self.betterPathHandler
connection.viabilityUpdateHandler = self.viabilityUpdateHandler
connection.pathUpdateHandler = self.pathChangedHandler(newPath:)
self.nwParametersConfigurator?(connection.parameters)
connection.start(queue: self.connectionQueue)
}