Skip to content

Instantly share code, notes, and snippets.

@bnoordhuis
Created May 15, 2012 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bnoordhuis/d730c35e35b309beb1bb to your computer and use it in GitHub Desktop.
Save bnoordhuis/d730c35e35b309beb1bb to your computer and use it in GitHub Desktop.
diff --git a/src/node.cc b/src/node.cc
index f8095b8..54e754e 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -1363,10 +1363,14 @@ Handle<Value> GetActiveHandles(const Arguments& args) {
ngx_queue_t* q = NULL;
int i = 0;
+ Local<String> owner_sym = String::New("owner");
+
ngx_queue_foreach(q, &handle_wrap_queue) {
HandleWrap* w = container_of(q, HandleWrap, handle_wrap_queue_);
if (w->object_.IsEmpty() || w->unref) continue;
- ary->Set(i++, w->object_);
+ Local<Value> obj = w->object_->Get(owner_sym);
+ if (obj->IsUndefined()) obj = *w->object_;
+ ary->Set(i++, obj);
}
return scope.Close(ary);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment