File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed
Sources/AsyncDNSResolver/c-ares Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change 22//
33// This source file is part of the SwiftAsyncDNSResolver open source project
44//
5- // Copyright (c) 2020-2023 Apple Inc. and the SwiftAsyncDNSResolver project authors
5+ // Copyright (c) 2020-2024 Apple Inc. and the SwiftAsyncDNSResolver project authors
66// Licensed under Apache License v2.0
77//
88// See LICENSE.txt for license information
@@ -195,6 +195,12 @@ extension Ares {
195195 private let channel : AresChannel
196196 private let pollIntervalNanos : UInt64
197197
198+ private var pollingTask : Task < Void , Error > ?
199+
200+ deinit {
201+ self . pollingTask? . cancel ( )
202+ }
203+
198204 init ( channel: AresChannel , pollIntervalNanos: UInt64 = QueryProcessor . defaultPollInterval) {
199205 self . channel = channel
200206 self . pollIntervalNanos = pollIntervalNanos
@@ -234,9 +240,12 @@ extension Ares {
234240 }
235241
236242 private func schedule( ) {
237- Task {
238- try await Task . sleep ( nanoseconds: self . pollIntervalNanos)
239- await self . poll ( )
243+ self . pollingTask = Task { [ weak self] in
244+ guard let s = self else {
245+ return
246+ }
247+ try await Task . sleep ( nanoseconds: s. pollIntervalNanos)
248+ await s. poll ( )
240249 }
241250 }
242251 }
Original file line number Diff line number Diff line change 33# #
44# # This source file is part of the SwiftAsyncDNSResolver open source project
55# #
6- # # Copyright (c) 2020-2023 Apple Inc. and the SwiftAsyncDNSResolver project authors
6+ # # Copyright (c) 2020-2024 Apple Inc. and the SwiftAsyncDNSResolver project authors
77# # Licensed under Apache License v2.0
88# #
99# # See LICENSE.txt for license information
@@ -18,7 +18,7 @@ here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1818
1919function replace_acceptable_years() {
2020 # this needs to replace all acceptable forms with 'YEARS'
21- sed -e ' s/202[012]-202[123 ]/YEARS/' -e ' s/202[0123 ]/YEARS/'
21+ sed -e ' s/202[012]-202[1234 ]/YEARS/' -e ' s/202[01234 ]/YEARS/'
2222}
2323
2424if ! hash swiftformat & > /dev/null
You can’t perform that action at this time.
0 commit comments