@@ -417,13 +417,11 @@ final class ConnectionPool {
417417
418418 private func makeConnection( on eventLoop: EventLoop ) -> EventLoopFuture < Connection > {
419419 self . activityPrecondition ( expected: [ . opened] )
420- let handshakePromise = eventLoop. makePromise ( of: Void . self)
421420 let address = HTTPClient . resolveAddress ( host: self . key. host, port: self . key. port, proxy: self . configuration. proxy)
422421 let bootstrap : NIOClientTCPBootstrap
423422 do {
424423 bootstrap = try makeHTTPClientBootstrapBase ( on: eventLoop)
425424 } catch {
426- handshakePromise. fail ( error)
427425 return eventLoop. makeFailedFuture ( error)
428426 }
429427
@@ -436,10 +434,8 @@ final class ConnectionPool {
436434 }
437435
438436 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 {
443439 let connection = Connection ( key: self . key, channel: channel, parentPool: self . parentPool)
444440 connection. isLeased = true
445441 return connection
@@ -448,9 +444,6 @@ final class ConnectionPool {
448444 self . configureCloseCallback ( of: connection)
449445 return connection
450446 } . 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)
454447 let action = self . parentPool. connectionProvidersLock. withLock {
455448 self . stateLock. withLock {
456449 self . state. failedConnectionAction ( )
0 commit comments