mirror of
https://github.com/nodejs/node.git
synced 2025-12-28 07:50:41 +00:00
src: register udp_wrap external references
PR-URL: https://github.com/nodejs/node/pull/50943 Refs: https://github.com/nodejs/node/issues/50924 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
0473d32150
commit
4d49aff3e5
@ -115,6 +115,7 @@ class ExternalReferenceRegistry {
|
||||
V(task_queue) \
|
||||
V(tcp_wrap) \
|
||||
V(tty_wrap) \
|
||||
V(udp_wrap) \
|
||||
V(url) \
|
||||
V(util) \
|
||||
V(pipe_wrap) \
|
||||
|
||||
@ -21,10 +21,11 @@
|
||||
|
||||
#include "udp_wrap.h"
|
||||
#include "env-inl.h"
|
||||
#include "handle_wrap.h"
|
||||
#include "node_buffer.h"
|
||||
#include "node_errors.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "node_sockaddr-inl.h"
|
||||
#include "handle_wrap.h"
|
||||
#include "req_wrap-inl.h"
|
||||
#include "util-inl.h"
|
||||
|
||||
@ -133,6 +134,12 @@ void UDPWrapBase::AddMethods(Environment* env, Local<FunctionTemplate> t) {
|
||||
SetProtoMethod(env->isolate(), t, "recvStop", RecvStop);
|
||||
}
|
||||
|
||||
void UDPWrapBase::RegisterExternalReferences(
|
||||
ExternalReferenceRegistry* registry) {
|
||||
registry->Register(RecvStart);
|
||||
registry->Register(RecvStop);
|
||||
}
|
||||
|
||||
UDPWrap::UDPWrap(Environment* env, Local<Object> object)
|
||||
: HandleWrap(env,
|
||||
object,
|
||||
@ -229,6 +236,34 @@ void UDPWrap::Initialize(Local<Object> target,
|
||||
constants).Check();
|
||||
}
|
||||
|
||||
void UDPWrap::RegisterExternalReferences(ExternalReferenceRegistry* registry) {
|
||||
UDPWrapBase::RegisterExternalReferences(registry);
|
||||
registry->Register(New);
|
||||
registry->Register(GetFD);
|
||||
|
||||
registry->Register(Open);
|
||||
registry->Register(Bind);
|
||||
registry->Register(Connect);
|
||||
registry->Register(Send);
|
||||
registry->Register(Bind6);
|
||||
registry->Register(Connect6);
|
||||
registry->Register(Send6);
|
||||
registry->Register(Disconnect);
|
||||
registry->Register(GetSockOrPeerName<UDPWrap, uv_udp_getpeername>);
|
||||
registry->Register(GetSockOrPeerName<UDPWrap, uv_udp_getsockname>);
|
||||
registry->Register(AddMembership);
|
||||
registry->Register(DropMembership);
|
||||
registry->Register(AddSourceSpecificMembership);
|
||||
registry->Register(DropSourceSpecificMembership);
|
||||
registry->Register(SetMulticastInterface);
|
||||
registry->Register(SetLibuvInt32<uv_udp_set_multicast_ttl>);
|
||||
registry->Register(SetLibuvInt32<uv_udp_set_multicast_loop>);
|
||||
registry->Register(SetLibuvInt32<uv_udp_set_broadcast>);
|
||||
registry->Register(SetLibuvInt32<uv_udp_set_ttl>);
|
||||
registry->Register(BufferSize);
|
||||
registry->Register(GetSendQueueSize);
|
||||
registry->Register(GetSendQueueCount);
|
||||
}
|
||||
|
||||
void UDPWrap::New(const FunctionCallbackInfo<Value>& args) {
|
||||
CHECK(args.IsConstructCall());
|
||||
@ -807,3 +842,5 @@ void UDPWrap::GetSendQueueCount(const FunctionCallbackInfo<Value>& args) {
|
||||
} // namespace node
|
||||
|
||||
NODE_BINDING_CONTEXT_AWARE_INTERNAL(udp_wrap, node::UDPWrap::Initialize)
|
||||
NODE_BINDING_EXTERNAL_REFERENCE(udp_wrap,
|
||||
node::UDPWrap::RegisterExternalReferences)
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
|
||||
namespace node {
|
||||
|
||||
class ExternalReferenceRegistry;
|
||||
class UDPWrapBase;
|
||||
|
||||
// A listener that can be attached to an `UDPWrapBase` object and generally
|
||||
@ -110,6 +111,7 @@ class UDPWrapBase {
|
||||
static void RecvStart(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
static void RecvStop(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
static void AddMethods(Environment* env, v8::Local<v8::FunctionTemplate> t);
|
||||
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
|
||||
|
||||
private:
|
||||
UDPListener* listener_ = nullptr;
|
||||
@ -126,6 +128,7 @@ class UDPWrap final : public HandleWrap,
|
||||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv);
|
||||
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
|
||||
static void GetFD(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
static void Open(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user