mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
Signed-off-by: Sebastian Beltran <bjohansebas@gmail.com> PR-URL: https://github.com/nodejs/node/pull/58535 Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day> Reviewed-By: Tim Perry <pimterry@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Aviv Keller <me@aviv.sh>
27 lines
680 B
JavaScript
27 lines
680 B
JavaScript
// Flags: --expose-internals --no-warnings
|
|
|
|
'use strict';
|
|
const common = require('../common');
|
|
const http = require('http');
|
|
const assert = require('assert');
|
|
const { kConnectionsCheckingInterval } = require('internal/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(common.mustCall(() => {
|
|
assert.ok(timer._destroyed);
|
|
}));
|
|
}
|
|
}, 2));
|
|
server.emit('listening');
|
|
server.emit('listening');
|