DNSResolver: Bugfix: Always call completion handler

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2018-11-02 18:10:51 +05:30
parent 29004c0ab6
commit f92fb1b9f4
1 changed files with 4 additions and 1 deletions

View File

@ -53,7 +53,10 @@ class DNSResolver {
dispatchGroup.notify(queue: .main) { dispatchGroup.notify(queue: .main) {
assert(endpoints.count == resolvedEndpoints.count) assert(endpoints.count == resolvedEndpoints.count)
for (i, endpoint) in endpoints.enumerated() { for (i, endpoint) in endpoints.enumerated() {
guard let endpoint = endpoint, let resolvedEndpoint = resolvedEndpoints[i] else { return } guard let endpoint = endpoint, let resolvedEndpoint = resolvedEndpoints[i] else {
completionHandler(nil)
return
}
if (isResolvedByDNSRequest[i]) { if (isResolvedByDNSRequest[i]) {
DNSResolver.cache.setObject(resolvedEndpoint.stringRepresentation() as NSString, DNSResolver.cache.setObject(resolvedEndpoint.stringRepresentation() as NSString,
forKey: endpoint.stringRepresentation() as NSString) forKey: endpoint.stringRepresentation() as NSString)