TS-4403: Fix stale-while-revalidate on DNS lookup failures (#609)

HostDB's "stale-while-revalidate" feature allows hostdb to return stale records while doing the DNS lookup in the background. This works properly in the case where the resolver goes away, but in the case that an error was returned from the resolver the record in cache was thrown away. This means that a transient error out in the DNS infrastructure would cause ATS to drop its stale record it would have contently served-- this patch simply makes hostdb honor its stale-while-revalidate contract (if configured). So, in the event that the DNS result comes back as `failed` hostdb will keep the old one if it is okay with being served stale.

This closes #609
(cherry picked from commit 131875cbe7b0975c8c3c4f3d20aa55a5c7caba86)
1 file changed