blob: 00a7b9f73e5bd6c73805f130850714c21d499b80 [file] [log] [blame] [edit]
'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(common.mustCall(() => {
assert.ok(timer._destroyed);
}));
}
}, 2));
server.emit('listening');
server.emit('listening');