summaryrefslogtreecommitdiff
path: root/src/req_wrap.h
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2012-04-28 18:45:10 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2012-05-15 21:00:27 +0200
commit5f0406534ca4a465d11892a747a38c0e5c884cf2 (patch)
treed77de6abca80b95d2729ecdb9d72e0f5b5370780 /src/req_wrap.h
parent636add246ca78be5c374cfd951c76de7f1010fb9 (diff)
downloadandroid-node-v8-5f0406534ca4a465d11892a747a38c0e5c884cf2.tar.gz
android-node-v8-5f0406534ca4a465d11892a747a38c0e5c884cf2.tar.bz2
android-node-v8-5f0406534ca4a465d11892a747a38c0e5c884cf2.zip
process: add _getActiveHandles(), _getActiveRequests()
* process._getActiveHandles() returns a list containing all active handles (timers, sockets, etc.) that have not been unref'd. * process._getActiveRequests() returns a list of active requests (in-flight actions like connecting to a remote host, writing data to a socket, etc.).
Diffstat (limited to 'src/req_wrap.h')
-rw-r--r--src/req_wrap.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/req_wrap.h b/src/req_wrap.h
index 11c7d12044..ba56821bbe 100644
--- a/src/req_wrap.h
+++ b/src/req_wrap.h
@@ -22,11 +22,14 @@
#ifndef REQ_WRAP_H_
#define REQ_WRAP_H_
+#include "ngx-queue.h"
+
namespace node {
// defined in node.cc
extern v8::Persistent<v8::String> process_symbol;
extern v8::Persistent<v8::String> domain_symbol;
+extern ngx_queue_t req_wrap_queue;
template <typename T>
class ReqWrap {
@@ -45,10 +48,13 @@ class ReqWrap {
// fprintf(stderr, "setting domain on ReqWrap\n");
object_->Set(domain_symbol, domain);
}
+
+ ngx_queue_insert_tail(&req_wrap_queue, &req_wrap_queue_);
}
~ReqWrap() {
+ ngx_queue_remove(&req_wrap_queue_);
// Assert that someone has called Dispatched()
assert(req_.data == this);
assert(!object_.IsEmpty());
@@ -62,8 +68,9 @@ class ReqWrap {
}
v8::Persistent<v8::Object> object_;
- T req_;
+ ngx_queue_t req_wrap_queue_;
void* data_;
+ T req_; // *must* be last, GetActiveRequests() in node.cc depends on it
};