summaryrefslogtreecommitdiff
path: root/lib/timers.js
diff options
context:
space:
mode:
authorMichael W <gcr@sneakygcr.net>2010-11-29 11:48:25 -0700
committerRyan Dahl <ry@tinyclouds.org>2010-11-29 18:17:13 -0800
commit645c3b37130ff5b8860868372ae3481759d7fb20 (patch)
tree527d2df6e4e00af2ebea997a21323be1292906e5 /lib/timers.js
parent22cf5a24dbc76c78acc161eec6c072263003b14e (diff)
downloadnode-new-645c3b37130ff5b8860868372ae3481759d7fb20.tar.gz
Fixed: clearTimeouts calling multiple times
When clearTimeouts was called on a timer multiple times, it would break the doubly-linked list along with future timeouts. This patch fixes that.
Diffstat (limited to 'lib/timers.js')
-rw-r--r--lib/timers.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/timers.js b/lib/timers.js
index cb049b0333..5419c03870 100644
--- a/lib/timers.js
+++ b/lib/timers.js
@@ -43,6 +43,7 @@ function shift (list) {
function remove (item) {
item._idleNext._idlePrev = item._idlePrev;
item._idlePrev._idleNext = item._idleNext;
+ item._idleNext = null;
}
@@ -111,8 +112,7 @@ function insert (item, msecs) {
var unenroll = exports.unenroll = function (item) {
if (item._idleNext) {
- item._idleNext._idlePrev = item._idlePrev;
- item._idlePrev._idleNext = item._idleNext;
+ remove(item);
var list = lists[item._idleTimeout];
// if empty then stop the watcher