@@ -181,7 +181,8 @@ void UDPWrap::Initialize(Local<Object> target,
181181 SetProtoMethod (isolate, t, " setMulticastLoopback" , SetMulticastLoopback);
182182 SetProtoMethod (isolate, t, " setBroadcast" , SetBroadcast);
183183 SetProtoMethod (isolate, t, " setTTL" , SetTTL);
184- SetProtoMethod (isolate, t, " bufferSize" , BufferSize);
184+ SetProtoMethod (isolate, t, " getSendQueueSize" , GetSendQueueSize);
185+ SetProtoMethod (isolate, t, " getSendQueueCount" , GetSendQueueCount);
185186
186187 t->Inherit (HandleWrap::GetConstructorTemplate (env));
187188
@@ -783,6 +784,23 @@ MaybeLocal<Object> UDPWrap::Instantiate(Environment* env,
783784 return env->udp_constructor_function ()->NewInstance (env->context ());
784785}
785786
787+ void UDPWrap::GetSendQueueSize (const FunctionCallbackInfo<Value>& args) {
788+ UDPWrap* wrap;
789+ ASSIGN_OR_RETURN_UNWRAP (
790+ &wrap, args.Holder (), args.GetReturnValue ().Set (UV_EBADF));
791+
792+ size_t size = uv_udp_get_send_queue_size (&wrap->handle_ );
793+ args.GetReturnValue ().Set (static_cast <double >(size));
794+ }
795+
796+ void UDPWrap::GetSendQueueCount (const FunctionCallbackInfo<Value>& args) {
797+ UDPWrap* wrap;
798+ ASSIGN_OR_RETURN_UNWRAP (
799+ &wrap, args.Holder (), args.GetReturnValue ().Set (UV_EBADF));
800+
801+ size_t count = uv_udp_get_send_queue_count (&wrap->handle_ );
802+ args.GetReturnValue ().Set (static_cast <double >(count));
803+ }
786804
787805} // namespace node
788806
0 commit comments