mirror of https://github.com/nodejs/node.git
udp: root JS objects in HandleScope with Local<>
parent
32b2964eed
commit
f86359cc3f
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue