Skip to content

Commit

Permalink
remove URLSession support for non-Apple platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnzhou committed Jun 22, 2024
1 parent 42bde8b commit c9d3817
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Sources/LCLPing/HTTP/HTTPPingClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ public final class HTTPPingClient: Pingable {
self.configuration = configuration
self.resultPromise = self.eventLoopGroup.next().makePromise(of: PingSummary.self)
if self.configuration.useURLSession {
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
self.pingClient = URLSessionClient(config: self.configuration, socketAddress: self.configuration.resolvedAddress, promise: self.resultPromise)
#else
preconditionFailure("URLSession is not supported on non-Apple platforms")
#endif
} else {
#if INTEGRATION_TEST
self.pingClient = NIOHTTPClient(eventLoopGroup: self.eventLoopGroup, configuration: self.configuration, resolvedAddress: self.configuration.resolvedAddress, networkLinkConfig: self.networkLinkConfig, promise: self.resultPromise)
Expand All @@ -65,7 +69,11 @@ public final class HTTPPingClient: Pingable {
self.resultPromise = self.eventLoopGroup.next().makePromise(of: PingSummary.self)
self.networkLinkConfig = networkLinkConfig
if self.configuration.useURLSession {
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
self.pingClient = URLSessionClient(config: self.configuration, socketAddress: self.configuration.resolvedAddress, promise: self.resultPromise)
#else
preconditionFailure("URLSession is not supported on non-Apple platforms")
#endif
} else {
#if INTEGRATION_TEST
self.pingClient = NIOHTTPClient(eventLoopGroup: self.eventLoopGroup, configuration: self.configuration, resolvedAddress: self.configuration.resolvedAddress, networkLinkConfig: self.networkLinkConfig, promise: self.resultPromise)
Expand Down

0 comments on commit c9d3817

Please sign in to comment.