Skip to content

Commit 8a3da7c

Browse files
committed
NIOTS set waitForActivity to false
Allow errors to be passed back to AsyncHTTPClient
1 parent e57d8bb commit 8a3da7c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Sources/AsyncHTTPClient/Utils.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,16 @@ extension NIOClientTCPBootstrap {
115115
let bootstrap: NIOClientTCPBootstrap
116116
#if canImport(Network)
117117
if #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *), eventLoop is NIOTSEventLoop {
118+
let tsBootstrap = NIOTSConnectionBootstrap(group: eventLoop).channelOption(NIOTSChannelOptions.waitForActivity, value: false)
118119
if configuration.proxy != nil, requiresTLS {
119120
let tlsConfiguration = configuration.tlsConfiguration ?? TLSConfiguration.forClient()
120121
let sslContext = try NIOSSLContext(configuration: tlsConfiguration)
121122
let hostname = (!requiresTLS || host.isIPAddress) ? nil : host
122-
bootstrap = try NIOClientTCPBootstrap(NIOTSConnectionBootstrap(group: eventLoop), tls: NIOSSLClientTLSProvider(context: sslContext, serverHostname: hostname))
123+
bootstrap = try NIOClientTCPBootstrap(tsBootstrap, tls: NIOSSLClientTLSProvider(context: sslContext, serverHostname: hostname))
123124
} else {
124125
let parameters = NIOClientTCPBootstrap.getTLSOptions(tlsConfiguration: configuration.tlsConfiguration, queue: tlsDispatchQueue)
125126
let tlsProvider = NIOTSClientTLSProvider(tlsOptions: parameters)
126-
bootstrap = NIOClientTCPBootstrap(NIOTSConnectionBootstrap(group: eventLoop), tls: tlsProvider)
127+
bootstrap = NIOClientTCPBootstrap(tsBootstrap, tls: tlsProvider)
127128
}
128129
} else {
129130
bootstrap = try ClientBootstrap.makeBootstrap(on: eventLoop, host: host, requiresTLS: requiresTLS, configuration: configuration)

0 commit comments

Comments
 (0)