Repository navigation
fix(apple): flush dns cache on resource updates - #10224
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a DNS caching issue on macOS where users cannot connect to newly granted DNS resources due to cached NXDOMAIN responses. The fix applies network settings to flush the DNS cache whenever the resource list changes.
- Flush DNS cache by calling
networkSettings.apply()when resources are updated - Add conditional check to only apply settings when resource list actually changes
- Include logging to track when DNS cache flushing occurs
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| // Update resource List. We don't care what's inside. | ||
| resourceListJSON = resourceList | ||
| if resourceListJSON != resourceList, let networkSettings = self.networkSettings { |
There was a problem hiding this comment.
The condition checks if resourceListJSON != resourceList but resourceListJSON is assigned to resourceList on line 377, which means this comparison happens before the assignment. This could lead to unexpected behavior if the intention is to check for changes after assignment.
There was a problem hiding this comment.
The intention is to check if they're different before assignment.
In the following sequence of events, a user will be unable to connect to the DNS resource for a few seconds because macOS is caching the queries, preventing connlib from seeing them.
To fix this, we call
networkSettings.apply()whenever the resource list has changed. This has been tested to trigger a DNS cache flush on macOS.