mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 12:04:25 +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>
32 lines
593 B
JavaScript
32 lines
593 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const net = require('net');
|
|
|
|
const iter = 10;
|
|
|
|
const server = net.createServer(function(socket) {
|
|
socket.on('readable', function() {
|
|
socket.read();
|
|
});
|
|
|
|
socket.on('end', function() {
|
|
server.close();
|
|
});
|
|
});
|
|
|
|
server.listen(0, function() {
|
|
const client = net.connect(this.address().port);
|
|
|
|
client.on('finish', function() {
|
|
assert.strictEqual(client.bufferSize, 0);
|
|
});
|
|
|
|
for (let i = 1; i < iter; i++) {
|
|
client.write('a');
|
|
assert.strictEqual(client.bufferSize, i);
|
|
}
|
|
|
|
client.end();
|
|
});
|