diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index b3e4bd50b25c82..64e96581b0b391 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include @@ -608,7 +608,7 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) { if (status) { // Error - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); argv[0] = Local::New(Null()); } else { // Success @@ -711,7 +711,7 @@ static Handle GetAddrInfo(const Arguments& args) { hints.ai_family = fam; hints.ai_socktype = SOCK_STREAM; - int r = uv_getaddrinfo(NODE_LOOP(), + int r = uv_getaddrinfo(Loop(), &req_wrap->req_, AfterGetAddrInfo, *hostname, @@ -720,7 +720,7 @@ static Handle GetAddrInfo(const Arguments& args) { req_wrap->Dispatched(); if (r) { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); delete req_wrap; return scope.Close(v8::Null()); } else { @@ -737,7 +737,7 @@ static void Initialize(Handle target) { assert(r == ARES_SUCCESS); struct ares_options options; - uv_ares_init_options(NODE_LOOP(), &ares_channel, &options, 0); + uv_ares_init_options(Loop(), &ares_channel, &options, 0); assert(r == 0); NODE_SET_METHOD(target, "queryA", Query); diff --git a/src/fs_event_wrap.cc b/src/fs_event_wrap.cc index 2e6dee4c47d97e..1f99e856a8d52a 100644 --- a/src/fs_event_wrap.cc +++ b/src/fs_event_wrap.cc @@ -21,7 +21,7 @@ #include #include -#include +#include #include @@ -110,15 +110,15 @@ Handle FSEventWrap::Start(const Arguments& args) { String::Utf8Value path(args[0]->ToString()); - int r = uv_fs_event_init(NODE_LOOP(), &wrap->handle_, *path, OnEvent, 0); + int r = uv_fs_event_init(Loop(), &wrap->handle_, *path, OnEvent, 0); if (r == 0) { // Check for persistent argument if (!args[1]->IsTrue()) { - uv_unref(NODE_LOOP()); + uv_unref(Loop()); } wrap->initialized_ = true; } else { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); } return scope.Close(Integer::New(r)); @@ -146,7 +146,7 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename, // assumption that a rename implicitly means an attribute change. Not too // unreasonable, right? Still, we should revisit this before v1.0. if (status) { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); eventStr = String::Empty(); } else if (events & UV_RENAME) { diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc index 2aff643eb30a70..f661885d9fa925 100644 --- a/src/handle_wrap.cc +++ b/src/handle_wrap.cc @@ -21,7 +21,7 @@ #include #include -#include +#include namespace node { @@ -71,7 +71,7 @@ Handle HandleWrap::Unref(const Arguments& args) { } wrap->unref = true; - uv_unref(NODE_LOOP()); + uv_unref(Loop()); return v8::Undefined(); } diff --git a/src/node.cc b/src/node.cc index 61b4547c342a17..548fdc7b3dcdf3 100644 --- a/src/node.cc +++ b/src/node.cc @@ -147,6 +147,15 @@ void StartThread(Isolate* isolate, char** argv); +uv_loop_t* Loop() { +#if defined(HAVE_ISOLATES) && HAVE_ISOLATES + return Isolate::GetCurrent()->GetLoop(); +#else + return uv_default_loop(); +#endif +} + + static void StartGCTimer () { if (!uv_is_active((uv_handle_t*) &gc_timer)) { uv_timer_start(&gc_timer, node::CheckStatus, 5000, 5000); @@ -173,7 +182,7 @@ static void Idle(uv_idle_t* watcher, int status) { static void Check(uv_check_t* watcher, int status) { assert(watcher == &gc_check); - tick_times[tick_time_head] = uv_now(NODE_LOOP()); + tick_times[tick_time_head] = uv_now(Loop()); tick_time_head = (tick_time_head + 1) % RPM_SAMPLES; StartGCTimer(); @@ -203,7 +212,7 @@ static void Tick(void) { need_tick_cb = false; if (uv_is_active((uv_handle_t*) &tick_spinner)) { uv_idle_stop(&tick_spinner); - uv_unref(NODE_LOOP()); + uv_unref(Loop()); } HandleScope scope; @@ -245,7 +254,7 @@ static Handle NeedTickCallback(const Arguments& args) { // tick_spinner to keep the event loop alive long enough to handle it. if (!uv_is_active((uv_handle_t*) &tick_spinner)) { uv_idle_start(&tick_spinner, Spin); - uv_ref(NODE_LOOP()); + uv_ref(Loop()); } return Undefined(); } @@ -1497,7 +1506,7 @@ static void CheckStatus(uv_timer_t* watcher, int status) { } } - double d = uv_now(NODE_LOOP()) - TICK_TIME(3); + double d = uv_now(Loop()) - TICK_TIME(3); //printfb("timer d = %f\n", d); @@ -1526,7 +1535,7 @@ static Handle Uptime(const Arguments& args) { v8::Handle UVCounters(const v8::Arguments& args) { HandleScope scope; - uv_counters_t* c = &NODE_LOOP()->counters; + uv_counters_t* c = &Loop()->counters; Local obj = Object::New(); diff --git a/src/node.h b/src/node.h index e8c532464e01cb..f17c3fcf81588d 100644 --- a/src/node.h +++ b/src/node.h @@ -75,8 +75,6 @@ #define NODE_STRINGIFY_HELPER(n) #n #endif -#define NODE_LOOP() (node::Isolate::GetCurrent()->GetLoop()) - namespace node { int Start(int argc, char *argv[]); @@ -86,6 +84,10 @@ v8::Handle SetupProcessObject(int argc, char *argv[]); void Load(v8::Handle process); void EmitExit(v8::Handle process); +// Returns the loop for the current isolate. If compiled with +// --without-isolates then this will always return uv_default_loop(); +uv_loop_t* Loop(); + #define NODE_PSYMBOL(s) \ v8::Persistent::New(v8::String::NewSymbol(s)) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 9cb7280771c924..bcd3949ec0767a 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -4118,7 +4118,7 @@ PBKDF2(const Arguments& args) { req = new uv_work_t(); req->data = request; - uv_queue_work(NODE_LOOP(), req, EIO_PBKDF2, EIO_PBKDF2After); + uv_queue_work(Loop(), req, EIO_PBKDF2, EIO_PBKDF2After); return Undefined(); @@ -4241,7 +4241,7 @@ Handle RandomBytes(const Arguments& args) { Local callback_v = Local(Function::Cast(*args[1])); req->callback_ = Persistent::New(callback_v); - uv_queue_work(NODE_LOOP(), + uv_queue_work(Loop(), &req->work_req_, RandomBytesWork, RandomBytesAfter); diff --git a/src/node_file.cc b/src/node_file.cc index e7293fb00ea2be..f7d2d87ed11d36 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -22,7 +22,7 @@ #include "node.h" #include "node_file.h" #include "node_buffer.h" -#include +#include #ifdef __POSIX__ # include "node_stat_watcher.h" #endif @@ -226,7 +226,7 @@ struct fs_req_wrap { #define ASYNC_CALL(func, callback, ...) \ FSReqWrap* req_wrap = new FSReqWrap(); \ - int r = uv_fs_##func(NODE_LOOP(), &req_wrap->req_, \ + int r = uv_fs_##func(Loop(), &req_wrap->req_, \ __VA_ARGS__, After); \ assert(r == 0); \ req_wrap->object_->Set(oncomplete_sym, callback); \ @@ -235,9 +235,9 @@ struct fs_req_wrap { #define SYNC_CALL(func, path, ...) \ fs_req_wrap req_wrap; \ - int result = uv_fs_##func(NODE_LOOP(), &req_wrap.req, __VA_ARGS__, NULL); \ + int result = uv_fs_##func(Loop(), &req_wrap.req, __VA_ARGS__, NULL); \ if (result < 0) { \ - int code = uv_last_error(NODE_LOOP()).code; \ + int code = uv_last_error(Loop()).code; \ return ThrowException(UVException(code, #func, "", path)); \ } diff --git a/src/node_zlib.cc b/src/node_zlib.cc index eb7d06d9c425e7..228427b64005da 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include @@ -134,7 +134,7 @@ template class ZCtx : public ObjectWrap { uv_work_t* work_req = new uv_work_t(); work_req->data = req_wrap; - uv_queue_work(NODE_LOOP(), + uv_queue_work(Loop(), work_req, ZCtx::Process, ZCtx::After); diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 483118ad8453e8..c33de3858f617e 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include @@ -124,7 +124,7 @@ Handle PipeWrap::New(const Arguments& args) { PipeWrap::PipeWrap(Handle object, bool ipc) : StreamWrap(object, (uv_stream_t*) &handle_) { - int r = uv_pipe_init(NODE_LOOP(), &handle_, ipc); + int r = uv_pipe_init(Loop(), &handle_, ipc); assert(r == 0); // How do we proxy this error up to javascript? // Suggestion: uv_pipe_init() returns void. handle_.data = reinterpret_cast(this); @@ -142,7 +142,7 @@ Handle PipeWrap::Bind(const Arguments& args) { int r = uv_pipe_bind(&wrap->handle_, *name); // Error starting the pipe. - if (r) SetErrno(uv_last_error(NODE_LOOP())); + if (r) SetErrno(uv_last_error(Loop())); return scope.Close(Integer::New(r)); } @@ -173,7 +173,7 @@ Handle PipeWrap::Listen(const Arguments& args) { int r = uv_listen((uv_stream_t*)&wrap->handle_, backlog, OnConnection); // Error starting the pipe. - if (r) SetErrno(uv_last_error(NODE_LOOP())); + if (r) SetErrno(uv_last_error(Loop())); return scope.Close(Integer::New(r)); } @@ -226,7 +226,7 @@ void PipeWrap::AfterConnect(uv_connect_t* req, int status) { assert(wrap->object_.IsEmpty() == false); if (status) { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); } Local argv[3] = { diff --git a/src/process_wrap.cc b/src/process_wrap.cc index 3d988ac1f51538..847a76352f8170 100644 --- a/src/process_wrap.cc +++ b/src/process_wrap.cc @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include @@ -176,7 +176,7 @@ class ProcessWrap : public HandleWrap { Get(String::NewSymbol("windowsVerbatimArguments"))->IsTrue(); #endif - int r = uv_spawn(NODE_LOOP(), &wrap->process_, options); + int r = uv_spawn(Loop(), &wrap->process_, options); wrap->SetHandle((uv_handle_t*)&wrap->process_); assert(wrap->process_.data == wrap); @@ -196,7 +196,7 @@ class ProcessWrap : public HandleWrap { delete [] options.env; } - if (r) SetErrno(uv_last_error(NODE_LOOP())); + if (r) SetErrno(uv_last_error(Loop())); return scope.Close(Integer::New(r)); } @@ -210,7 +210,7 @@ class ProcessWrap : public HandleWrap { int r = uv_process_kill(&wrap->process_, signal); - if (r) SetErrno(uv_last_error(NODE_LOOP())); + if (r) SetErrno(uv_last_error(Loop())); return scope.Close(Integer::New(r)); } diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index fbe9152b5a3341..a64b4c356c58f9 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include @@ -133,7 +133,7 @@ Handle StreamWrap::ReadStart(const Arguments& args) { } // Error starting the tcp. - if (r) SetErrno(uv_last_error(NODE_LOOP())); + if (r) SetErrno(uv_last_error(Loop())); return scope.Close(Integer::New(r)); } @@ -147,7 +147,7 @@ Handle StreamWrap::ReadStop(const Arguments& args) { int r = uv_read_stop(wrap->stream_); // Error starting the tcp. - if (r) SetErrno(uv_last_error(NODE_LOOP())); + if (r) SetErrno(uv_last_error(Loop())); return scope.Close(Integer::New(r)); } @@ -226,7 +226,7 @@ void StreamWrap::OnReadCommon(uv_stream_t* handle, ssize_t nread, slab_used -= buf.len; } - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); MakeCallback(wrap->object_, "onread", 0, NULL); return; } @@ -339,7 +339,7 @@ Handle StreamWrap::Write(const Arguments& args) { wrap->UpdateWriteQueueSize(); if (r) { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); delete req_wrap; return scope.Close(v8::Null()); } else { @@ -359,7 +359,7 @@ void StreamWrap::AfterWrite(uv_write_t* req, int status) { assert(wrap->object_.IsEmpty() == false); if (status) { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); } wrap->UpdateWriteQueueSize(); @@ -389,7 +389,7 @@ Handle StreamWrap::Shutdown(const Arguments& args) { req_wrap->Dispatched(); if (r) { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); delete req_wrap; return scope.Close(v8::Null()); } else { @@ -409,7 +409,7 @@ void StreamWrap::AfterShutdown(uv_shutdown_t* req, int status) { HandleScope scope; if (status) { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); } Local argv[3] = { diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index 83fdcdd14af5c7..2871025d765685 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include @@ -155,7 +155,7 @@ Handle TCPWrap::New(const Arguments& args) { TCPWrap::TCPWrap(Handle object) : StreamWrap(object, (uv_stream_t*) &handle_) { - int r = uv_tcp_init(NODE_LOOP(), &handle_); + int r = uv_tcp_init(Loop(), &handle_); assert(r == 0); // How do we proxy this error up to javascript? // Suggestion: uv_tcp_init() returns void. UpdateWriteQueueSize(); @@ -183,7 +183,7 @@ Handle TCPWrap::GetSockName(const Arguments& args) { Local sockname = Object::New(); if (r != 0) { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); } else { family = address.ss_family; @@ -225,7 +225,7 @@ Handle TCPWrap::GetPeerName(const Arguments& args) { Local sockname = Object::New(); if (r != 0) { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); } else { family = address.ss_family; @@ -258,7 +258,7 @@ Handle TCPWrap::SetNoDelay(const Arguments& args) { int r = uv_tcp_nodelay(&wrap->handle_, 1); if (r) - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); return Undefined(); } @@ -274,7 +274,7 @@ Handle TCPWrap::SetKeepAlive(const Arguments& args) { int r = uv_tcp_keepalive(&wrap->handle_, enable, delay); if (r) - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); return Undefined(); } @@ -290,7 +290,7 @@ Handle TCPWrap::SetSimultaneousAccepts(const Arguments& args) { int r = uv_tcp_simultaneous_accepts(&wrap->handle_, enable ? 1 : 0); if (r) - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); return Undefined(); } @@ -309,7 +309,7 @@ Handle TCPWrap::Bind(const Arguments& args) { int r = uv_tcp_bind(&wrap->handle_, address); // Error starting the tcp. - if (r) SetErrno(uv_last_error(NODE_LOOP())); + if (r) SetErrno(uv_last_error(Loop())); return scope.Close(Integer::New(r)); } @@ -327,7 +327,7 @@ Handle TCPWrap::Bind6(const Arguments& args) { int r = uv_tcp_bind6(&wrap->handle_, address); // Error starting the tcp. - if (r) SetErrno(uv_last_error(NODE_LOOP())); + if (r) SetErrno(uv_last_error(Loop())); return scope.Close(Integer::New(r)); } @@ -343,7 +343,7 @@ Handle TCPWrap::Listen(const Arguments& args) { int r = uv_listen((uv_stream_t*)&wrap->handle_, backlog, OnConnection); // Error starting the tcp. - if (r) SetErrno(uv_last_error(NODE_LOOP())); + if (r) SetErrno(uv_last_error(Loop())); return scope.Close(Integer::New(r)); } @@ -378,7 +378,7 @@ void TCPWrap::OnConnection(uv_stream_t* handle, int status) { // Successful accept. Call the onconnection callback in JavaScript land. argv[0] = client_obj; } else { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); argv[0] = v8::Null(); } @@ -397,7 +397,7 @@ void TCPWrap::AfterConnect(uv_connect_t* req, int status) { assert(wrap->object_.IsEmpty() == false); if (status) { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); } Local argv[3] = { @@ -433,7 +433,7 @@ Handle TCPWrap::Connect(const Arguments& args) { req_wrap->Dispatched(); if (r) { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); delete req_wrap; return scope.Close(v8::Null()); } else { @@ -460,7 +460,7 @@ Handle TCPWrap::Connect6(const Arguments& args) { req_wrap->Dispatched(); if (r) { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); delete req_wrap; return scope.Close(v8::Null()); } else { diff --git a/src/timer_wrap.cc b/src/timer_wrap.cc index 82b7ec984e8378..2b29e5f854a16d 100644 --- a/src/timer_wrap.cc +++ b/src/timer_wrap.cc @@ -21,7 +21,7 @@ #include #include -#include +#include #define UNWRAP \ assert(!args.Holder().IsEmpty()); \ @@ -92,7 +92,7 @@ class TimerWrap : public HandleWrap { : HandleWrap(object, (uv_handle_t*) &handle_) { active_ = false; - int r = uv_timer_init(NODE_LOOP(), &handle_); + int r = uv_timer_init(Loop(), &handle_); assert(r == 0); handle_.data = this; @@ -100,11 +100,11 @@ class TimerWrap : public HandleWrap { // uv_timer_init adds a loop reference. (That is, it calls uv_ref.) This // is not the behavior we want in Node. Timers should not increase the // ref count of the loop except when active. - uv_unref(NODE_LOOP()); + uv_unref(Loop()); } ~TimerWrap() { - if (!active_) uv_ref(NODE_LOOP()); + if (!active_) uv_ref(Loop()); } void StateChange() { @@ -114,11 +114,11 @@ class TimerWrap : public HandleWrap { if (!was_active && active_) { // If our state is changing from inactive to active, we // increase the loop's reference count. - uv_ref(NODE_LOOP()); + uv_ref(Loop()); } else if (was_active && !active_) { // If our state is changing from active to inactive, we // decrease the loop's reference count. - uv_unref(NODE_LOOP()); + uv_unref(Loop()); } } @@ -133,7 +133,7 @@ class TimerWrap : public HandleWrap { int r = uv_timer_start(&wrap->handle_, OnTimeout, timeout, repeat); // Error starting the timer. - if (r) SetErrno(uv_last_error(NODE_LOOP())); + if (r) SetErrno(uv_last_error(Loop())); wrap->StateChange(); @@ -147,7 +147,7 @@ class TimerWrap : public HandleWrap { int r = uv_timer_stop(&wrap->handle_); - if (r) SetErrno(uv_last_error(NODE_LOOP())); + if (r) SetErrno(uv_last_error(Loop())); wrap->StateChange(); @@ -161,7 +161,7 @@ class TimerWrap : public HandleWrap { int r = uv_timer_again(&wrap->handle_); - if (r) SetErrno(uv_last_error(NODE_LOOP())); + if (r) SetErrno(uv_last_error(Loop())); wrap->StateChange(); @@ -187,7 +187,7 @@ class TimerWrap : public HandleWrap { int64_t repeat = uv_timer_get_repeat(&wrap->handle_); - if (repeat < 0) SetErrno(uv_last_error(NODE_LOOP())); + if (repeat < 0) SetErrno(uv_last_error(Loop())); return scope.Close(Integer::New(repeat)); } diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc index 1ec8410f16b166..31949011f311fa 100644 --- a/src/tty_wrap.cc +++ b/src/tty_wrap.cc @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include @@ -125,7 +125,7 @@ class TTYWrap : StreamWrap { int r = uv_tty_get_winsize(&wrap->handle_, &width, &height); if (r) { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); return v8::Undefined(); } @@ -144,7 +144,7 @@ class TTYWrap : StreamWrap { int r = uv_tty_set_mode(&wrap->handle_, args[0]->IsTrue()); if (r) { - SetErrno(uv_last_error(NODE_LOOP())); + SetErrno(uv_last_error(Loop())); } return scope.Close(Integer::New(r)); @@ -170,7 +170,7 @@ class TTYWrap : StreamWrap { TTYWrap(Handle object, int fd, bool readable) : StreamWrap(object, (uv_stream_t*)&handle_) { - uv_tty_init(NODE_LOOP(), &handle_, fd, readable); + uv_tty_init(Loop(), &handle_, fd, readable); } uv_tty_t handle_; diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index f0c487ecedabb4..dce45ada49887c 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 @@ class UDPWrap: public HandleWrap { 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();