//===----------------------------------------------------------------------===// // // This source file is part of the AsyncHTTPClient open source project // // Copyright (c) 2022 Apple Inc. and the AsyncHTTPClient project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information // See CONTRIBUTORS.txt for the list of AsyncHTTPClient project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// import NIOCore extension HTTPClient { /// Shuts down the client and `EventLoopGroup` if it was created by the client. @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) public func shutdown() async throws { try await withCheckedThrowingContinuation { (continuation: CheckedContinuation) in self.shutdown { error in switch error { case .none: continuation.resume() case .some(let error): continuation.resume(throwing: error) } } } } }