mirror of
https://github.com/nodejs/node.git
synced 2024-11-22 07:37:56 +01:00
b3678dff52
Fix this issue follow these two points: 1. Keep track of how many queries are currently open. If `setServers()` is called while there are open queries, error out. 2. 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. PR-URL: https://github.com/nodejs/node/pull/14891 Fixes: https://github.com/nodejs/node/issues/14734 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
19 lines
610 B
JavaScript
19 lines
610 B
JavaScript
'use strict';
|
|
|
|
// We don't care about `err` in the callback function of `dns.resolve4`. We just
|
|
// want to test whether `dns.setServers` that is run after `resolve4` will cause
|
|
// a crash or not. If it doesn't crash, the test succeeded.
|
|
|
|
const common = require('../common');
|
|
const { addresses } = require('../common/internet');
|
|
const dns = require('dns');
|
|
|
|
dns.resolve4(
|
|
addresses.INET4_HOST,
|
|
common.mustCall(function(/* err, nameServers */) {
|
|
dns.setServers([ addresses.DNS4_SERVER ]);
|
|
}));
|
|
|
|
// Test https://github.com/nodejs/node/issues/14734
|
|
dns.resolve4(addresses.INET4_HOST, common.mustCall());
|