mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 22:56:06 +00:00

Manually fix issues that eslint --fix couldn't do automatically. PR-URL: https://github.com/nodejs/node/pull/10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
34 lines
667 B
JavaScript
34 lines
667 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const net = require('net');
|
|
|
|
const server = net.createServer(common.mustCall(function(stream) {
|
|
stream.setTimeout(100);
|
|
|
|
stream.resume();
|
|
|
|
stream.on('timeout', common.mustCall(function() {
|
|
console.log('timeout');
|
|
// try to reset the timeout.
|
|
stream.write('WHAT.');
|
|
}));
|
|
|
|
stream.on('end', function() {
|
|
console.log('server side end');
|
|
stream.end();
|
|
});
|
|
}));
|
|
|
|
server.listen(0, function() {
|
|
const c = net.createConnection(this.address().port);
|
|
|
|
c.on('data', function() {
|
|
c.end();
|
|
});
|
|
|
|
c.on('end', function() {
|
|
console.log('client side end');
|
|
server.close();
|
|
});
|
|
});
|