     var atEnd: Bool {
         let unresolvedHostCount = unresolvedHosts.count
         let unresolvedConnectionCount = connections.count - connectionResults.count
-        debugLog("Unresolved hosts: \(unresolvedHostCount), " +
-                 "unresolved connections: \(unresolvedConnectionCount)")
+        debugLog("Unresolved hosts: \(unresolvedHostCount) \(unresolvedHosts), " +
+                 "unresolved connections: \(unresolvedConnectionCount), " +
+                 "total connections: \(connections.count), " +
+                 "total hosts: \(hosts.count)")
         return unresolvedHostCount == 0 && unresolvedConnectionCount == 0
     }
 

            case let .Success(connections):
                self.connections += connections
                throttleConnections()
            case let .Failure(error):
                let unresolvedHostURLs = self.unresolvedHosts.map { $0.hostURL }
                debugLog("Got error resolving host, trying next one: \(error). " +

        switch result {
            case let .Success(referenceTime):
                self.referenceTime = referenceTime
                finish(result)
            case .Failure:
                throttleConnections()
                if atEnd {
                    finish(result)
                }
        }
    }

    func finish(result: ReferenceTimeResult) {
        guard !hosts.isEmpty else {
            return // Guard against race condition where we receive two responses at once.
        }

        let endTime = CFAbsoluteTimeGetCurrent()
        debugLog("\(connectionResults.count) results: \(connectionResults)")
        debugLog("Took \(endTime - startTime!)s")
        callbacks.forEach { (queue, callback) in
            dispatch_async(queue) {
                callback(result)
            }
        }

        callbacks = []
        if result.value != nil {
            stopQueue()
        }
    }
}
