Skip to content

dns.setServers doesn't play well with async code #1071

@silverwind

Description

@silverwind

nodejs/node-v0.x-archive#9243 (comment) led me to realizing that the way dns.setServers is implemented doesn't play too well with async code.

The current target server is stored in a per-app global state, which would probably be fine with sync code, but complicates things if you want to query multiple servers with our async resolve.

I'd propose adding an options object to resolve containing servers, while deprecating dns.setServers in a major version. I think having an option object on resolve methods could prove useful later.

Note: I haven't checked if c-ares enables per-query target servers easily, maybe @indutny can comment on that part.

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.dnsIssues and PRs related to the dns subsystem.stalledIssues and PRs that are stalled.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions