diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc index 817a4cfe1cd..9c243ea2c9f 100644 --- a/src/handle_wrap.cc +++ b/src/handle_wrap.cc @@ -63,7 +63,7 @@ Handle HandleWrap::Ref(const Arguments& args) { if (wrap) { uv_ref(wrap->handle__); - wrap->unref_ = false; + wrap->flags_ &= ~kUnref; } return v8::Undefined(); @@ -77,7 +77,7 @@ Handle HandleWrap::Unref(const Arguments& args) { if (wrap) { uv_unref(wrap->handle__); - wrap->unref_ = true; + wrap->flags_ |= kUnref; } return v8::Undefined(); @@ -102,7 +102,7 @@ Handle HandleWrap::Close(const Arguments& args) { HandleWrap::HandleWrap(Handle object, uv_handle_t* h) { - unref_ = false; + flags_ = 0; handle__ = h; if (h) { h->data = this; diff --git a/src/handle_wrap.h b/src/handle_wrap.h index 951b9386f5c..c77ec77f1a0 100644 --- a/src/handle_wrap.h +++ b/src/handle_wrap.h @@ -70,7 +70,9 @@ class HandleWrap { // Using double underscore due to handle_ member in tcp_wrap. Probably // tcp_wrap should rename it's member to 'handle'. uv_handle_t* handle__; - bool unref_; + unsigned int flags_; + + static const unsigned int kUnref = 1; }; diff --git a/src/node.cc b/src/node.cc index 2793d19c62e..279bb0c05b7 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1382,7 +1382,7 @@ Handle GetActiveHandles(const Arguments& args) { ngx_queue_foreach(q, &handle_wrap_queue) { HandleWrap* w = container_of(q, HandleWrap, handle_wrap_queue_); - if (w->object_.IsEmpty() || w->unref_) continue; + if (w->object_.IsEmpty() || (w->flags_ & HandleWrap::kUnref)) continue; Local obj = w->object_->Get(owner_sym); if (obj->IsUndefined()) obj = *w->object_; ary->Set(i++, obj);