2022-12-05 04:55:58 +00:00
|
|
|
'use strict';
|
2023-02-23 09:47:13 +00:00
|
|
|
|
2022-12-05 04:55:58 +00:00
|
|
|
require('../common');
|
2023-02-23 09:47:13 +00:00
|
|
|
|
2022-12-05 04:55:58 +00:00
|
|
|
const assert = require('assert');
|
|
|
|
const net = require('net');
|
|
|
|
|
|
|
|
for (const autoSelectFamilyAttemptTimeout of [-10, 0]) {
|
|
|
|
assert.throws(() => {
|
|
|
|
net.connect({
|
|
|
|
port: 8080,
|
|
|
|
autoSelectFamily: true,
|
|
|
|
autoSelectFamilyAttemptTimeout,
|
|
|
|
});
|
|
|
|
}, { code: 'ERR_OUT_OF_RANGE' });
|
2023-02-23 09:47:13 +00:00
|
|
|
|
|
|
|
assert.throws(() => {
|
|
|
|
net.setDefaultAutoSelectFamilyAttemptTimeout(autoSelectFamilyAttemptTimeout);
|
|
|
|
}, { code: 'ERR_OUT_OF_RANGE' });
|
2022-12-05 04:55:58 +00:00
|
|
|
}
|
2023-03-10 15:07:55 +00:00
|
|
|
|
|
|
|
// Check the default value of autoSelectFamilyAttemptTimeout is 10
|
|
|
|
// if passed number is less than 10
|
|
|
|
for (const autoSelectFamilyAttemptTimeout of [1, 9]) {
|
|
|
|
net.setDefaultAutoSelectFamilyAttemptTimeout(autoSelectFamilyAttemptTimeout);
|
|
|
|
assert.strictEqual(net.getDefaultAutoSelectFamilyAttemptTimeout(), 10);
|
|
|
|
}
|