Idle timeout changes

- setTimeout should active the timeout too. (test-net-set-timeout tests
  this.)

- 'timeout' event is not automatically followed by an 'error' event. That
  is the user is now responsible for destroying the stream if there is an
  idle timeout.
This commit is contained in:
Ryan Dahl committed 2010-05-12 10:06:13 -07:00
1 parent f7ff548dd0
commit d2cff34fa3
4 files changed
+57 -15

No files matched your search

+4 -2
View File
@@ -146,7 +146,6 @@ var timeout = new (function () {
remove(first);
assert(first != peek(list));
first.emit('timeout');
first.destroy(new Error('idle timeout'));
}
}
debug(msecs + ' list empty');
@@ -816,7 +815,10 @@ Stream.prototype.setKeepAlive = function (enable, time) {
};
Stream.prototype.setTimeout = function (msecs) {
timeout.enroll(this, msecs);
if (msecs > 0) {
timeout.enroll(this, msecs);
if (this.fd) { timeout.active(this); }
}
};