mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
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:
1 parent
f7ff548dd0
commit
d2cff34fa3
4 files changed
+57
-15
No files matched your search
+4
-2
@@ -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); }
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user