2016-11-22 13:13:44 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const common = require('../common');
|
2017-07-01 02:29:09 +03:00
|
|
|
if (!common.hasIPv6)
|
2016-11-22 13:13:44 -03:00
|
|
|
common.skip('IPv6 support required');
|
|
|
|
|
2017-07-01 02:29:09 +03:00
|
|
|
const initHooks = require('./init-hooks');
|
|
|
|
const verifyGraph = require('./verify-graph');
|
2016-11-22 13:13:44 -03:00
|
|
|
const net = require('net');
|
|
|
|
|
|
|
|
const hooks = initHooks();
|
|
|
|
hooks.enable();
|
|
|
|
|
|
|
|
const server = net
|
|
|
|
.createServer(onconnection)
|
|
|
|
.on('listening', common.mustCall(onlistening));
|
|
|
|
server.listen();
|
|
|
|
function onlistening() {
|
|
|
|
net.connect(server.address().port, common.mustCall(onconnected));
|
|
|
|
}
|
|
|
|
|
|
|
|
function onconnection(c) {
|
|
|
|
c.end();
|
|
|
|
this.close(onserverClosed);
|
|
|
|
}
|
|
|
|
|
|
|
|
function onconnected() {}
|
|
|
|
|
|
|
|
function onserverClosed() {}
|
|
|
|
|
|
|
|
process.on('exit', onexit);
|
|
|
|
|
|
|
|
function onexit() {
|
|
|
|
hooks.disable();
|
|
|
|
verifyGraph(
|
|
|
|
hooks,
|
2017-11-20 17:18:40 +01:00
|
|
|
[ { type: 'TCPSERVERWRAP', id: 'tcpserver:1', triggerAsyncId: null },
|
|
|
|
{ type: 'TCPWRAP', id: 'tcp:1', triggerAsyncId: 'tcpserver:1' },
|
2016-11-22 13:13:44 -03:00
|
|
|
{ type: 'GETADDRINFOREQWRAP',
|
2017-11-20 17:18:40 +01:00
|
|
|
id: 'getaddrinforeq:1', triggerAsyncId: 'tcp:1' },
|
2016-11-22 13:13:44 -03:00
|
|
|
{ type: 'TCPCONNECTWRAP',
|
2017-11-20 17:18:40 +01:00
|
|
|
id: 'tcpconnect:1', triggerAsyncId: 'tcp:1' },
|
|
|
|
{ type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcpserver:1' },
|
2022-11-21 12:43:47 -05:00
|
|
|
{ type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'tcp:2' } ],
|
2016-11-22 13:13:44 -03:00
|
|
|
);
|
|
|
|
}
|