xref: /third_party/node/test/parallel/test-dgram-unref-in-cluster.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ciconst dgram = require('dgram');
41cb0ef41Sopenharmony_ciconst cluster = require('cluster');
51cb0ef41Sopenharmony_ciconst assert = require('assert');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciif (common.isWindows)
81cb0ef41Sopenharmony_ci  common.skip('dgram clustering is currently not supported on Windows.');
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ciif (cluster.isPrimary) {
111cb0ef41Sopenharmony_ci  cluster.fork();
121cb0ef41Sopenharmony_ci} else {
131cb0ef41Sopenharmony_ci  const socket = dgram.createSocket('udp4');
141cb0ef41Sopenharmony_ci  socket.unref();
151cb0ef41Sopenharmony_ci  socket.bind();
161cb0ef41Sopenharmony_ci  socket.on('listening', common.mustCall(() => {
171cb0ef41Sopenharmony_ci    const sockets = process.getActiveResourcesInfo().filter((item) => {
181cb0ef41Sopenharmony_ci      return item === 'UDPWrap';
191cb0ef41Sopenharmony_ci    });
201cb0ef41Sopenharmony_ci    assert.ok(sockets.length === 0);
211cb0ef41Sopenharmony_ci    process.disconnect();
221cb0ef41Sopenharmony_ci  }));
231cb0ef41Sopenharmony_ci}
24

Indexes created Thu Nov 07 10:32:03 CST 2024