From 20ba454ef9e8ff2bb19abb26f9b95265beb98e11 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Thu, 22 Dec 2011 13:40:26 -0800 Subject: Add node::Loop() and don't inc node_isolate.h in *.cc node::Loop() replaces the NODE_LOOP macro. This avoids hitting v8::Isolate::GetCurrent() for each loop lookup when HAVE_ISOLATE==0 --- src/udp_wrap.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/udp_wrap.cc') diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index f0c487ece..dce45ada4 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include @@ -104,7 +104,7 @@ private: UDPWrap::UDPWrap(Handle object): HandleWrap(object, (uv_handle_t*)&handle_) { - int r = uv_udp_init(NODE_LOOP(), &handle_); + int r = uv_udp_init(Loop(), &handle_); assert(r == 0); // can't fail anyway handle_.data = reinterpret_cast(this); } @@ -177,7 +177,7 @@ Handle UDPWrap::DoBind(const Arguments& args, int family) { } if (r) - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); return scope.Close(Integer::New(r)); } @@ -234,7 +234,7 @@ Handle UDPWrap::DoSend(const Arguments& args, int family) { req_wrap->Dispatched(); if (r) { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); delete req_wrap; return Null(); } @@ -261,8 +261,8 @@ Handle UDPWrap::RecvStart(const Arguments& args) { // UV_EALREADY means that the socket is already bound but that's okay int r = uv_udp_recv_start(&wrap->handle_, OnAlloc, OnRecv); - if (r && uv_last_error(NODE_LOOP()).code != UV_EALREADY) { - SetErrno(uv_last_error(NODE_LOOP())); + if (r && uv_last_error(Loop()).code != UV_EALREADY) { + SetErrno(uv_last_error(Loop())); return False(); } @@ -298,7 +298,7 @@ Handle UDPWrap::GetSockName(const Arguments& args) { return scope.Close(sockname); } else { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); return Null(); } } @@ -317,7 +317,7 @@ void UDPWrap::OnSend(uv_udp_send_t* req, int status) { assert(wrap->object_.IsEmpty() == false); if (status) { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); } Local argv[4] = { @@ -365,7 +365,7 @@ void UDPWrap::OnRecv(uv_udp_t* handle, }; if (nread == -1) { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); } else { Local rinfo = Object::New(); -- cgit v1.2.1