Skip to content

Commit 9d4e9ef

Browse files
committed
Formatting changes
1 parent 72c384b commit 9d4e9ef

File tree

8 files changed

+353
-356
lines changed

8 files changed

+353
-356
lines changed

Sources/AsyncHTTPClient/ConnectionPool.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import Foundation
1616
import NIO
1717
import NIOConcurrencyHelpers
1818
import NIOHTTP1
19-
import NIOTransportServices
2019
import NIOTLS
20+
import NIOTransportServices
2121

2222
/// A connection pool that manages and creates new connections to hosts respecting the specified preferences
2323
///
@@ -376,9 +376,9 @@ final class ConnectionPool {
376376
self.activityPrecondition(expected: [.opened])
377377
let address = HTTPClient.resolveAddress(host: self.key.host, port: self.key.port, proxy: self.configuration.proxy)
378378
let requiresTLS = self.key.scheme == .https
379-
let bootstrap : NIOClientTCPBootstrap
379+
let bootstrap: NIOClientTCPBootstrap
380380
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)
382382
} catch {
383383
return eventLoop.makeFailedFuture(error)
384384
}
@@ -396,28 +396,28 @@ final class ConnectionPool {
396396
let requiresSSLHandler = self.configuration.proxy != nil && self.key.scheme == .https
397397
channel.pipeline.addSSLHandlerIfNeeded(for: self.key, tlsConfiguration: self.configuration.tlsConfiguration, addSSLClient: requiresSSLHandler, handshakePromise: handshakePromise)
398398
return handshakePromise.futureResult.flatMap {
399-
channel.pipeline.addHTTPClientHandlers(leftOverBytesStrategy: .forwardBytes)
399+
channel.pipeline.addHTTPClientHandlers(leftOverBytesStrategy: .forwardBytes)
400400
}.flatMap {
401401
#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+
}
405405
#endif
406406
return eventLoop.makeSucceededFuture(())
407407
}.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
411411
}
412412
}.map { connection in
413413
self.configureCloseCallback(of: connection)
414414
return connection
415415
}.flatMapError { error in
416416
var error = error
417417
#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+
}
421421
#endif
422422
// This promise may not have been completed if we reach this
423423
// so we fail it to avoid any leak

Sources/AsyncHTTPClient/HTTPClient.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import NIOConcurrencyHelpers
1818
import NIOHTTP1
1919
import NIOHTTPCompression
2020
import NIOSSL
21-
import NIOTransportServices
2221
import NIOTLS
22+
import NIOTransportServices
2323

2424
/// HTTPClient class provides API for request execution.
2525
///
@@ -67,13 +67,13 @@ public class HTTPClient {
6767
self.eventLoopGroup = group
6868
case .createNew:
6969
#if canImport(Network)
70-
if #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) {
71-
self.eventLoopGroup = NIOTSEventLoopGroup()
72-
} else {
73-
self.eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
74-
}
70+
if #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) {
71+
self.eventLoopGroup = NIOTSEventLoopGroup()
72+
} else {
73+
self.eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
74+
}
7575
#else
76-
self.eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
76+
self.eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
7777
#endif
7878
}
7979
self.configuration = configuration
@@ -694,7 +694,7 @@ extension ChannelPipeline {
694694
let context = try NIOSSLContext(configuration: tlsConfiguration)
695695
handlers = [
696696
try NIOSSLClientHandler(context: context, serverHostname: key.host.isIPAddress ? nil : key.host),
697-
TLSEventsHandler(completionPromise: handshakePromise)
697+
TLSEventsHandler(completionPromise: handshakePromise),
698698
]
699699
} else {
700700
handlers = [TLSEventsHandler(completionPromise: handshakePromise)]

0 commit comments

Comments
 (0)