New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic Server List #594
Merged
Merged
Dynamic Server List #594
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alright, after that last commit, think things should build fully |
vojtechvobr
added a commit
to vojtechvobr/c-ares
that referenced
this pull request
Feb 15, 2024
ares__strsplit provides a newly allocated buffer, so suffix list in line variable isn't referenced anymore. Related ares_free seems to have gone missing during refactoring made in c-ares#594
bradh352
pushed a commit
that referenced
this pull request
Feb 15, 2024
ares__strsplit provides a newly allocated buffer, so suffix list in line variable isn't referenced anymore. Related ares_free seems to have gone missing during refactoring made in #594 Fix By: Vojtěch Vobr (@vojtechvobr)
bradh352
pushed a commit
that referenced
this pull request
Feb 15, 2024
ares__strsplit provides a newly allocated buffer, so suffix list in line variable isn't referenced anymore. Related ares_free seems to have gone missing during refactoring made in #594 Fix By: Vojtěch Vobr (@vojtechvobr)
bradh352
pushed a commit
that referenced
this pull request
Feb 15, 2024
ares__strsplit provides a newly allocated buffer, so suffix list in line variable isn't referenced anymore. Related ares_free seems to have gone missing during refactoring made in #594 Fix By: Vojtěch Vobr (@vojtechvobr)
bradh352
pushed a commit
that referenced
this pull request
Feb 15, 2024
ares__strsplit provides a newly allocated buffer, so suffix list in line variable isn't referenced anymore. Related ares_free seems to have gone missing during refactoring made in #594 Fix By: Vojtěch Vobr (@vojtechvobr)
bradh352
pushed a commit
that referenced
this pull request
Feb 15, 2024
ares__strsplit provides a newly allocated buffer, so suffix list in line variable isn't referenced anymore. Related ares_free seems to have gone missing during refactoring made in #594 Fix By: Vojtěch Vobr (@vojtechvobr)
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes the server list a dynamic sorted list of servers. The sort order is [ consecutive failures, system config index ]. The server list can be updated via
ares_set_servers_*()
. Any queries currently directed to servers that are no longer in the list will be automatically re-queued to a different server.Also, any time a failure occurs on the server, the sort order of the servers will be updated so that the one with the fewest consecutive failures is chosen for the next query that goes on the wire, this way bad or non-responsive servers are automatically isolated.
Since the server list is now dynamic, the tracking of query failures per server has been removed and instead is relying on the server sort order as previously described. This simplifies the logic while also reducing the amount of memory required per query. However, because of this dynamic nature, it may not be easy to determine the server attempt order for enqueued queries if there have been any failures.
If using the
ARES_OPT_ROTATE
, this is now implemented to be a random selection of the configured servers. Since the server list is dynamic, its not possible to go to the next server as configuration could have changed between queries or attempts for the same query.Finally, this PR moved some existing functions into new files to logically separate them.
This should address issues #550 and #440, while also setting the framework to implement #301. #301 needs a little more effort since it configures things other than the servers themselves (domains, search, sortlist, lookups), which need to make sure they can be safely updated.
Fix By: Brad House (@bradh352)