Browse Source

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.
v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
5f5201db2f
  1. 4
      lib/net.js
  2. 8
      test/simple/test-net-connect-timeout.js

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);

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

Loading…
Cancel
Save