• 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(common.mustCall(onconnection))
16  .on('listening', common.mustCall(onlistening));
17
18server.listen(0);
19
20net.connect({ port: server.address().port, host: '::1' },
21            common.mustCall(onconnected));
22
23function onlistening() {}
24
25function onconnected() {}
26
27function onconnection(c) {
28  c.end();
29  this.close(common.mustCall(onserverClosed));
30}
31
32function onserverClosed() {}
33
34process.on('exit', onexit);
35
36function onexit() {
37  hooks.disable();
38
39  verifyGraph(
40    hooks,
41    [ { type: 'TCPSERVERWRAP', id: 'tcpserver:1', triggerAsyncId: null },
42      { type: 'TCPWRAP', id: 'tcp:1', triggerAsyncId: null },
43      { type: 'TCPCONNECTWRAP',
44        id: 'tcpconnect:1', triggerAsyncId: 'tcp:1' },
45      { type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcpserver:1' },
46      { type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'tcp:2' } ],
47  );
48}
49