mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
41796ebd30
The server.connections property was runtime deprecated in the 0.9 days. It was replaced with getConnections(). It is not simply an alias for getConnections() because it fails to take connections shared with forks into consideration. Let's not keep it around forever and move it to end of life Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/33647 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
34 lines
689 B
JavaScript
34 lines
689 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const net = require('net');
|
|
|
|
const server = net.createServer(handle);
|
|
|
|
const N = 100;
|
|
const buf = Buffer.alloc(2, 'a');
|
|
|
|
server.listen(0, function() {
|
|
const conn = net.connect(this.address().port);
|
|
|
|
conn.on('connect', () => {
|
|
let res = true;
|
|
let i = 0;
|
|
for (; i < N && res; i++) {
|
|
conn.cork();
|
|
conn.write(buf);
|
|
res = conn.write(buf);
|
|
conn.uncork();
|
|
}
|
|
assert.strictEqual(i, N);
|
|
conn.end();
|
|
});
|
|
});
|
|
|
|
function handle(socket) {
|
|
socket.resume();
|
|
socket.on('error', common.mustNotCall())
|
|
.on('close', common.mustCall(() => server.close()));
|
|
}
|