mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
4e9ce7c035
PR-URL: https://github.com/nodejs/node/pull/52118 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
25 lines
611 B
JavaScript
25 lines
611 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const http = require('http');
|
|
const assert = require('assert');
|
|
const { kConnectionsCheckingInterval } = require('_http_server');
|
|
|
|
let i = 0;
|
|
let timer;
|
|
const server = http.createServer();
|
|
server.on('listening', common.mustCall(() => {
|
|
// If there was a timer, it must be destroyed
|
|
if (timer) {
|
|
assert.ok(timer._destroyed);
|
|
}
|
|
// Save the last timer
|
|
timer = server[kConnectionsCheckingInterval];
|
|
if (++i === 2) {
|
|
server.close(() => {
|
|
assert.ok(timer._destroyed);
|
|
});
|
|
}
|
|
}, 2));
|
|
server.emit('listening');
|
|
server.emit('listening');
|