%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
'use strict'; // Tests that calling unref() on Http2Session: // (1) Prevents it from keeping the process alive // (2) Doesn't crash const common = require('../common'); if (!common.hasCrypto) common.skip('missing crypto'); const http2 = require('http2'); const Countdown = require('../common/countdown'); const makeDuplexPair = require('../common/duplexpair'); const server = http2.createServer(); const { clientSide, serverSide } = makeDuplexPair(); const counter = new Countdown(3, () => server.unref()); // 'session' event should be emitted 3 times: // - the vanilla client // - the destroyed client // - manual 'connection' event emission with generic Duplex stream server.on('session', common.mustCallAtLeast((session) => { counter.dec(); session.unref(); }, 3)); server.listen(0, common.mustCall(() => { const port = server.address().port; // unref new client { const client = http2.connect(`http://localhost:${port}`); client.unref(); } // Unref destroyed client { const client = http2.connect(`http://localhost:${port}`); client.on('connect', common.mustCall(() => { client.destroy(); client.unref(); })); } // Unref destroyed client { const client = http2.connect(`http://localhost:${port}`, { createConnection: common.mustCall(() => clientSide) }); client.on('connect', common.mustCall(() => { client.destroy(); client.unref(); })); } })); server.emit('connection', serverSide);