Permalink
Browse files

export HandleWrap Unref Ref in tcp/udp/timer/pipe

  • Loading branch information...
1 parent 5bb2fe6 commit 19d43f852e3428fe231ce662f94b154ae51254e0 @tjfontaine tjfontaine committed with piscisaureus Jul 13, 2012
Showing with 9 additions and 0 deletions.
  1. +1 −0 src/pipe_wrap.cc
  2. +3 −0 src/tcp_wrap.cc
  3. +2 −0 src/timer_wrap.cc
  4. +3 −0 src/udp_wrap.cc
View
@@ -84,6 +84,7 @@ void PipeWrap::Initialize(Handle<Object> target) {
NODE_SET_PROTOTYPE_METHOD(t, "close", HandleWrap::Close);
NODE_SET_PROTOTYPE_METHOD(t, "unref", HandleWrap::Unref);
+ NODE_SET_PROTOTYPE_METHOD(t, "ref", HandleWrap::Ref);
NODE_SET_PROTOTYPE_METHOD(t, "readStart", StreamWrap::ReadStart);
NODE_SET_PROTOTYPE_METHOD(t, "readStop", StreamWrap::ReadStop);
View
@@ -96,6 +96,9 @@ void TCPWrap::Initialize(Handle<Object> target) {
NODE_SET_PROTOTYPE_METHOD(t, "close", HandleWrap::Close);
+ NODE_SET_PROTOTYPE_METHOD(t, "ref", HandleWrap::Ref);
+ NODE_SET_PROTOTYPE_METHOD(t, "unref", HandleWrap::Unref);
+
NODE_SET_PROTOTYPE_METHOD(t, "readStart", StreamWrap::ReadStart);
NODE_SET_PROTOTYPE_METHOD(t, "readStop", StreamWrap::ReadStop);
NODE_SET_PROTOTYPE_METHOD(t, "shutdown", StreamWrap::Shutdown);
View
@@ -52,6 +52,8 @@ class TimerWrap : public HandleWrap {
constructor->SetClassName(String::NewSymbol("Timer"));
NODE_SET_PROTOTYPE_METHOD(constructor, "close", HandleWrap::Close);
+ NODE_SET_PROTOTYPE_METHOD(constructor, "ref", HandleWrap::Ref);
+ NODE_SET_PROTOTYPE_METHOD(constructor, "unref", HandleWrap::Unref);
NODE_SET_PROTOTYPE_METHOD(constructor, "start", Start);
NODE_SET_PROTOTYPE_METHOD(constructor, "stop", Stop);
View
@@ -110,6 +110,9 @@ void UDPWrap::Initialize(Handle<Object> target) {
NODE_SET_PROTOTYPE_METHOD(t, "setBroadcast", SetBroadcast);
NODE_SET_PROTOTYPE_METHOD(t, "setTTL", SetTTL);
+ NODE_SET_PROTOTYPE_METHOD(t, "ref", HandleWrap::Ref);
+ NODE_SET_PROTOTYPE_METHOD(t, "unref", HandleWrap::Unref);
+
target->Set(String::NewSymbol("UDP"),
Persistent<FunctionTemplate>::New(t)->GetFunction());
}

3 comments on commit 19d43f8

Could you tell in a few words what is this change for?

In case you want a timer to not hold the loop active, but fire while the loop is active

update -- the logic is valid for all handle types

Please sign in to comment.