dns: fix crash while setting server during query
Fix this issue follow these two points:
- Keep track of how many queries are currently open. If
setServers()
is called while there are open queries, error out. - For
Resolver
instances, use option 1. For dns.setServers(), just create a fresh new default channel every time it is called, and then set its servers list.
Fixes: https://github.com/nodejs/node/issues/14734
Checklist
-
make -j4 test
passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
dns, cares