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.
This commit is contained in:
Ryan Dahl 2011-01-12 13:29:43 -08:00
parent 5f795efd4e
commit 5f5201db2f
2 changed files with 5 additions and 7 deletions

View File

@ -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 File

@ -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();
});