mirror of
https://github.com/apple/swift-nio
synced 2026-11-28 05:14:23 +00:00
Motivation: The HappyEyeballs connector synchronises state on an event loop but calls out to a 'Resolver' to do DNS lookups. The resolver returns results as a future which may be on a different loop than the connector. The connector does not hop back to its own event loop before processing the results. For client bootstraps, if no resolver is specified then the default resolver uses the same event loop as the connector so in many cases this is not an issue. However, if a custom resolver is used this guarantee is lost and data races are much more likely. Modifications: - Hop back to the connector's event loop after calling the resolver. - Add a test. Result: Fewer data races.