udp: root JS objects in HandleScope with Local<>

pull/24503/head
Ben Noordhuis 2012-03-26 05:55:30 -07:00
parent 32b2964eed
commit f86359cc3f
1 changed files with 6 additions and 5 deletions

View File

@ -420,11 +420,11 @@ void UDPWrap::OnRecv(uv_udp_t* handle,
UDPWrap* wrap = reinterpret_cast<UDPWrap*>(handle->data); UDPWrap* wrap = reinterpret_cast<UDPWrap*>(handle->data);
Handle<Value> argv[4] = { Local<Value> argv[4] = {
wrap->object_, Local<Object>::New(wrap->object_),
Integer::New(nread), Integer::New(nread),
Null(), Local<Value>::New(Null()),
Null() Local<Value>::New(Null())
}; };
if (nread == -1) { if (nread == -1) {
@ -433,7 +433,8 @@ void UDPWrap::OnRecv(uv_udp_t* handle,
else { else {
Local<Object> rinfo = Object::New(); Local<Object> rinfo = Object::New();
AddressToJS(rinfo, addr, sizeof *addr); AddressToJS(rinfo, addr, sizeof *addr);
argv[2] = Buffer::New(buf.base, nread, NULL, NULL)->handle_; argv[2] = Local<Object>::New(
Buffer::New(buf.base, nread, NULL, NULL)->handle_);
argv[3] = rinfo; argv[3] = rinfo;
} }
free(buf.base); free(buf.base);