diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2010-10-26 09:04:39 +0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-10-26 12:10:18 +0400 |
commit | 2470d2ee92b162ebcc4eda68958769715c3d17fb (patch) | |
tree | ec2c5b0039eb7652e12bf48101db9204ca6c3ccb /test | |
parent | a7b4af0ae5408c96020e79c224e17891f836c28a (diff) |
allowHalfOpen disabled by default
Users too often would forget to add
socket.on('end', function () {
socket.end();
});
Which is a mistake. Therefore we default to this behavior and
only optionally let people handle the 'end' case themselves.
Diffstat (limited to 'test')
-rw-r--r-- | test/pummel/test-net-pingpong-delay.js | 2 | ||||
-rw-r--r-- | test/pummel/test-net-pingpong.js | 2 | ||||
-rw-r--r-- | test/simple/test-net-pingpong.js | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/test/pummel/test-net-pingpong-delay.js b/test/pummel/test-net-pingpong-delay.js index 39e746b1d66..f1e3dace439 100644 --- a/test/pummel/test-net-pingpong-delay.js +++ b/test/pummel/test-net-pingpong-delay.js @@ -11,7 +11,7 @@ function pingPongTest (port, host, on_complete) { var count = 0; var client_ended = false; - var server = net.createServer(function (socket) { + var server = net.createServer({ allowHalfOpen: true }, function (socket) { socket.setEncoding("utf8"); socket.addListener("data", function (data) { diff --git a/test/pummel/test-net-pingpong.js b/test/pummel/test-net-pingpong.js index 48704ef0489..e58b4734a4f 100644 --- a/test/pummel/test-net-pingpong.js +++ b/test/pummel/test-net-pingpong.js @@ -9,7 +9,7 @@ function pingPongTest (port, host, on_complete) { var count = 0; var sent_final_ping = false; - var server = net.createServer(function (socket) { + var server = net.createServer({ allowHalfOpen: true }, function (socket) { assert.equal(true, socket.remoteAddress !== null); assert.equal(true, socket.remoteAddress !== undefined); if (host === "127.0.0.1" || host === "localhost" || !host) { diff --git a/test/simple/test-net-pingpong.js b/test/simple/test-net-pingpong.js index 5db5e127e3f..6596d0030cd 100644 --- a/test/simple/test-net-pingpong.js +++ b/test/simple/test-net-pingpong.js @@ -10,7 +10,7 @@ function pingPongTest (port, host) { var count = 0; var sent_final_ping = false; - var server = net.createServer(function (socket) { + var server = net.createServer({ allowHalfOpen: true }, function (socket) { console.log("connection: " + socket.remoteAddress); assert.equal(server, socket.server); assert.equal(1, server.connections); @@ -30,7 +30,7 @@ function pingPongTest (port, host) { }); socket.addListener("end", function () { - assert.equal(true, socket.writable); + assert.equal(true, socket.writable); // because allowHalfOpen assert.equal(false, socket.readable); socket.end(); }); |