@@ -94,6 +94,7 @@ class UDPWrap: public HandleWrap {
94
94
static Handle <Value> AddMembership (const Arguments& args);
95
95
static Handle <Value> DropMembership (const Arguments& args);
96
96
static Handle <Value> SetMulticastTTL (const Arguments& args);
97
+ static Handle <Value> SetMulticastLoopback (const Arguments& args);
97
98
static Handle <Value> SetBroadcast (const Arguments& args);
98
99
99
100
private:
@@ -156,6 +157,7 @@ void UDPWrap::Initialize(Handle<Object> target) {
156
157
NODE_SET_PROTOTYPE_METHOD (t, " addMembership" , AddMembership);
157
158
NODE_SET_PROTOTYPE_METHOD (t, " dropMembership" , DropMembership);
158
159
NODE_SET_PROTOTYPE_METHOD (t, " setMulticastTTL" , SetMulticastTTL);
160
+ NODE_SET_PROTOTYPE_METHOD (t, " setMulticastLoopback" , SetMulticastLoopback);
159
161
NODE_SET_PROTOTYPE_METHOD (t, " setBroadcast" , SetBroadcast);
160
162
161
163
target->Set (String::NewSymbol (" UDP" ),
@@ -262,6 +264,7 @@ Handle<Value> UDPWrap::DropMembership(const Arguments& args) {
262
264
return SetMembership (args, UV_LEAVE_GROUP);
263
265
}
264
266
267
+
265
268
Handle <Value> UDPWrap::SetMulticastTTL (const Arguments& args) {
266
269
HandleScope scope;
267
270
UNWRAP
@@ -277,6 +280,23 @@ Handle<Value> UDPWrap::SetMulticastTTL(const Arguments& args) {
277
280
return scope.Close (Integer::New (r));
278
281
}
279
282
283
+
284
+ Handle <Value> UDPWrap::SetMulticastLoopback (const Arguments& args) {
285
+ HandleScope scope;
286
+ UNWRAP
287
+
288
+ assert (args.Length () == 1 );
289
+
290
+ int on = args[0 ]->Int32Value ();
291
+ int r = uv_udp_set_multicast_loop (&wrap->handle_ , on);
292
+
293
+ if (r)
294
+ SetErrno (uv_last_error (uv_default_loop ()));
295
+
296
+ return scope.Close (Integer::New (r));
297
+ }
298
+
299
+
280
300
Handle <Value> UDPWrap::DoSend (const Arguments& args, int family) {
281
301
HandleScope scope;
282
302
int r;
0 commit comments