From b6e0b1094a0111614636226bf61f31e37688338a Mon Sep 17 00:00:00 2001 From: Jeremiah Senkpiel Date: Mon, 25 Apr 2016 19:29:47 -0400 Subject: [PATCH] timers: use HandleWrap::HasRef() --- lib/timers.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/timers.js b/lib/timers.js index dc2506e01e09a4..c26d52a077ce2a 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -133,8 +133,6 @@ function insert(item, unrefed) { list = new TimersList(msecs, unrefed); L.init(list); list._timer._list = list; - - if (unrefed === true) list._timer.unref(); list._timer.start(msecs, 0); lists[msecs] = list; @@ -149,7 +147,7 @@ function TimersList(msecs, unrefed) { this._idleNext = null; // Create the list with the linkedlist properties to this._idlePrev = null; // prevent any unnecessary hidden class changes. this._timer = new TimerWrap(); - this._unrefed = unrefed; + if (unrefed === true) this._timer.unref(); this.msecs = msecs; } @@ -206,12 +204,12 @@ function listOnTimeout() { // As such, we can remove the list and clean up the TimerWrap C++ handle. debug('%d list empty', msecs); assert(L.isEmpty(list)); - this.close(); - if (list._unrefed === true) { - delete unrefedLists[msecs]; - } else { + if (this.hasRef() === true) { delete refedLists[msecs]; + } else { + delete unrefedLists[msecs]; } + this.close(); }