@@ -16,8 +16,8 @@ import Foundation
16
16
import NIO
17
17
import NIOConcurrencyHelpers
18
18
import NIOHTTP1
19
- import NIOTransportServices
20
19
import NIOTLS
20
+ import NIOTransportServices
21
21
22
22
/// A connection pool that manages and creates new connections to hosts respecting the specified preferences
23
23
///
@@ -376,9 +376,9 @@ final class ConnectionPool {
376
376
self . activityPrecondition ( expected: [ . opened] )
377
377
let address = HTTPClient . resolveAddress ( host: self . key. host, port: self . key. port, proxy: self . configuration. proxy)
378
378
let requiresTLS = self . key. scheme == . https
379
- let bootstrap : NIOClientTCPBootstrap
379
+ let bootstrap : NIOClientTCPBootstrap
380
380
do {
381
- bootstrap = try NIOClientTCPBootstrap . makeHTTPClientBootstrapBase ( on: eventLoop, host: key. host, port: key. port, requiresTLS: requiresTLS, configuration: self . configuration)
381
+ bootstrap = try NIOClientTCPBootstrap . makeHTTPClientBootstrapBase ( on: eventLoop, host: self . key. host, port: self . key. port, requiresTLS: requiresTLS, configuration: self . configuration)
382
382
} catch {
383
383
return eventLoop. makeFailedFuture ( error)
384
384
}
@@ -396,28 +396,28 @@ final class ConnectionPool {
396
396
let requiresSSLHandler = self . configuration. proxy != nil && self . key. scheme == . https
397
397
channel. pipeline. addSSLHandlerIfNeeded ( for: self . key, tlsConfiguration: self . configuration. tlsConfiguration, addSSLClient: requiresSSLHandler, handshakePromise: handshakePromise)
398
398
return handshakePromise. futureResult. flatMap {
399
- channel. pipeline. addHTTPClientHandlers ( leftOverBytesStrategy: . forwardBytes)
399
+ channel. pipeline. addHTTPClientHandlers ( leftOverBytesStrategy: . forwardBytes)
400
400
} . flatMap {
401
401
#if canImport(Network)
402
- if #available( OSX 10 . 14 , iOS 12 . 0 , tvOS 12 . 0 , watchOS 6 . 0 , * ) , bootstrap. underlyingBootstrap is NIOTSConnectionBootstrap {
403
- return channel. pipeline. addHandler ( NWErrorHandler ( ) , position: . first)
404
- }
402
+ if #available( OSX 10 . 14 , iOS 12 . 0 , tvOS 12 . 0 , watchOS 6 . 0 , * ) , bootstrap. underlyingBootstrap is NIOTSConnectionBootstrap {
403
+ return channel. pipeline. addHandler ( NWErrorHandler ( ) , position: . first)
404
+ }
405
405
#endif
406
406
return eventLoop. makeSucceededFuture ( ( ) )
407
407
} . map {
408
- let connection = Connection ( key: self . key, channel: channel, parentPool: self . parentPool)
409
- connection. isLeased = true
410
- return connection
408
+ let connection = Connection ( key: self . key, channel: channel, parentPool: self . parentPool)
409
+ connection. isLeased = true
410
+ return connection
411
411
}
412
412
} . map { connection in
413
413
self . configureCloseCallback ( of: connection)
414
414
return connection
415
415
} . flatMapError { error in
416
416
var error = error
417
417
#if canImport(Network)
418
- if #available( OSX 10 . 14 , iOS 12 . 0 , tvOS 12 . 0 , watchOS 6 . 0 , * ) , bootstrap. underlyingBootstrap is NIOTSConnectionBootstrap {
419
- error = NWErrorHandler . translateError ( error)
420
- }
418
+ if #available( OSX 10 . 14 , iOS 12 . 0 , tvOS 12 . 0 , watchOS 6 . 0 , * ) , bootstrap. underlyingBootstrap is NIOTSConnectionBootstrap {
419
+ error = NWErrorHandler . translateError ( error)
420
+ }
421
421
#endif
422
422
// This promise may not have been completed if we reach this
423
423
// so we fail it to avoid any leak
0 commit comments