Permalink
Browse files

Fix test-net-connect-buffer

Change to end() behavior in 33c339 was breaking it. end() should wait for
connection before dumping. Changed test-net-connect-timeout to use destroy()
instead.
  • Loading branch information...
1 parent 5f795ef commit 5f5201db2ffaeb773f32e747d268307089156148 @ry ry committed Jan 12, 2011
Showing with 5 additions and 7 deletions.
  1. +1 −3 lib/net.js
  2. +4 −4 test/simple/test-net-connect-timeout.js
View
4 lib/net.js
@@ -787,9 +787,7 @@ Socket.prototype._shutdown = function() {
Socket.prototype.end = function(data, encoding) {
- if (this._connecting) {
- this.destroy();
- } else if (this.writable) {
+ if (this.writable) {
if (this._writeQueueLast() !== END_OF_FILE) {
if (data) this.write(data, encoding);
this._writeQueue.push(END_OF_FILE);
View
8 test/simple/test-net-connect-timeout.js
@@ -30,13 +30,13 @@ socket0.on('timeout', function() {
gotTimeout0 = true;
var now = new Date();
assert.ok(now - start < T + 500);
- socket0.end();
+ socket0.destroy();
});
socket0.on('connect', function() {
console.error("connect");
gotConnect0 = true;
- socket0.end();
+ socket0.destroy();
});
@@ -51,13 +51,13 @@ socket1.on('timeout', function() {
gotTimeout1 = true;
var now = new Date();
assert.ok(now - start < T + 500);
- socket1.end();
+ socket1.destroy();
});
socket1.on('connect', function() {
console.error("connect");
gotConnect1 = true;
- socket1.end();
+ socket1.destroy();
});

0 comments on commit 5f5201d

Please sign in to comment.