test: clarify dropMembership() call
authorRich Trott <rtrott@gmail.com>
Fri, 26 Jun 2015 01:54:25 +0000 (18:54 -0700)
committerRich Trott <rtrott@gmail.com>
Sun, 9 Aug 2015 20:23:37 +0000 (13:23 -0700)
According to docs, dropMembership() is automatically called
by the kernel when the socket is closed, and most apps will
never need to call it. It's called here as a sanity check
only so let's note that with a comment.

Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/nodejs/io.js/pull/2062

test/internet/test-dgram-multicast-multi-process.js

index 05acb844e54490798240b907cd1a29aecf511e12..34db38331dc7b6eff37c9ef4d49c657a4f2c7fb6 100644 (file)
@@ -3,7 +3,6 @@ var common = require('../common'),
     assert = require('assert'),
     dgram = require('dgram'),
     util = require('util'),
-    assert = require('assert'),
     Buffer = require('buffer').Buffer,
     fork = require('child_process').fork,
     LOCAL_BROADCAST_HOST = '224.0.0.114',
@@ -183,10 +182,9 @@ if (process.argv[2] === 'child') {
     process.send({ message: buf.toString() });
 
     if (receivedMessages.length == messages.length) {
+      // .dropMembership() not strictly needed but here as a sanity check
       listenSocket.dropMembership(LOCAL_BROADCAST_HOST);
-
-      process.nextTick(function() { // TODO should be changed to below.
-        // listenSocket.dropMembership(LOCAL_BROADCAST_HOST, function() {
+      process.nextTick(function() {
         listenSocket.close();
       });
     }