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