@@ -414,13 +414,11 @@ final class ConnectionPool {
414
414
415
415
private func makeConnection( on eventLoop: EventLoop ) -> EventLoopFuture < Connection > {
416
416
self . activityPrecondition ( expected: [ . opened] )
417
- let handshakePromise = eventLoop. makePromise ( of: Void . self)
418
417
let address = HTTPClient . resolveAddress ( host: self . key. host, port: self . key. port, proxy: self . configuration. proxy)
419
418
let bootstrap : NIOClientTCPBootstrap
420
419
do {
421
420
bootstrap = try makeHTTPClientBootstrapBase ( on: eventLoop)
422
421
} catch {
423
- handshakePromise. fail ( error)
424
422
return eventLoop. makeFailedFuture ( error)
425
423
}
426
424
@@ -433,10 +431,8 @@ final class ConnectionPool {
433
431
}
434
432
435
433
return channel. flatMap { channel -> EventLoopFuture < ConnectionPool . Connection > in
436
- handshakePromise. succeed ( ( ) )
437
- return handshakePromise. futureResult. flatMap {
438
- channel. pipeline. addHTTPClientHandlers ( leftOverBytesStrategy: . forwardBytes)
439
- } . map {
434
+
435
+ channel. pipeline. addHTTPClientHandlers ( leftOverBytesStrategy: . forwardBytes) . map {
440
436
let connection = Connection ( key: self . key, channel: channel, parentPool: self . parentPool)
441
437
connection. isLeased = true
442
438
return connection
@@ -445,9 +441,6 @@ final class ConnectionPool {
445
441
self . configureCloseCallback ( of: connection)
446
442
return connection
447
443
} . flatMapError { error in
448
- // This promise may not have been completed if we reach this
449
- // so we fail it to avoid any leak
450
- handshakePromise. fail ( error)
451
444
let action = self . parentPool. connectionProvidersLock. withLock {
452
445
self . stateLock. withLock {
453
446
self . state. failedConnectionAction ( )
0 commit comments