0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-https-server-close-destroy-timeout.js
linkgoron bd7a8087a5
https: fix connection checking interval not clearing on server close
The connection interval should close when httpsServer.close is called
similarly to how it gets cleared when httpServer.close is called.

fixes: https://github.com/nodejs/node/issues/48373
PR-URL: https://github.com/nodejs/node/pull/48383
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2023-06-12 07:47:25 +00:00

25 lines
711 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
if (!common.hasCrypto) {
common.skip('missing crypto');
}
const { createServer } = require('https');
const { kConnectionsCheckingInterval } = require('_http_server');
const fixtures = require('../common/fixtures');
const options = {
key: fixtures.readKey('agent1-key.pem'),
cert: fixtures.readKey('agent1-cert.pem')
};
const server = createServer(options, function(req, res) {});
server.listen(0, common.mustCall(function() {
assert.strictEqual(server[kConnectionsCheckingInterval]._destroyed, false);
server.close(common.mustCall(() => {
assert(server[kConnectionsCheckingInterval]._destroyed);
}));
}));