• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4if (!common.hasIPv6)
5  common.skip('IPv6 support required');
6
7const initHooks = require('./init-hooks');
8const verifyGraph = require('./verify-graph');
9const net = require('net');
10
11const hooks = initHooks();
12hooks.enable();
13
14const server = net
15  .createServer(onconnection)
16  .on('listening', common.mustCall(onlistening));
17server.listen();
18function onlistening() {
19  net.connect(server.address().port, common.mustCall(onconnected));
20}
21
22function onconnection(c) {
23  c.end();
24  this.close(onserverClosed);
25}
26
27function onconnected() {}
28
29function onserverClosed() {}
30
31process.on('exit', onexit);
32
33function onexit() {
34  hooks.disable();
35  verifyGraph(
36    hooks,
37    [ { type: 'TCPSERVERWRAP', id: 'tcpserver:1', triggerAsyncId: null },
38      { type: 'TCPWRAP', id: 'tcp:1', triggerAsyncId: 'tcpserver:1' },
39      { type: 'GETADDRINFOREQWRAP',
40        id: 'getaddrinforeq:1', triggerAsyncId: 'tcp:1' },
41      { type: 'TCPCONNECTWRAP',
42        id: 'tcpconnect:1', triggerAsyncId: 'tcp:1' },
43      { type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcpserver:1' },
44      { type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'tcp:2' } ],
45  );
46}
47