diff options
author | Rich Trott <rtrott@gmail.com> | 2016-05-16 13:24:08 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2016-05-16 14:52:08 -0700 |
commit | 78520fa472e57d9a98619a057bf2686fb66adee5 (patch) | |
tree | 43fb6f03b2022b4c19c44979cb1d7a2c28dea711 /test/internet | |
parent | 5f31b7e014dca80da7818db5e235062b4dab24de (diff) | |
download | node-new-78520fa472e57d9a98619a057bf2686fb66adee5.tar.gz |
test,dgram: add tests for setBroadcast()
The only tests for `setBroadcast()` (from the `dgram` module) were in
`test/internet` which means they almost never get run. This adds a
minimal test that can check JS-land functionality in `test/parallel`.
I also expanded a comment and did some minor formatting on the existing
`test/internet` test. If there were an easy and reliable way to check
for the BROADCAST flag on an interface, it's possible that a version of
the test could be moved to `test/sequential` or `test/parallel` once it
was modified to only use internal networks.
PR-URL: https://github.com/nodejs/node/pull/6750
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/internet')
-rw-r--r-- | test/internet/test-dgram-broadcast-multi-process.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/internet/test-dgram-broadcast-multi-process.js b/test/internet/test-dgram-broadcast-multi-process.js index 21133f2956..0925432571 100644 --- a/test/internet/test-dgram-broadcast-multi-process.js +++ b/test/internet/test-dgram-broadcast-multi-process.js @@ -20,7 +20,9 @@ if (common.inFreeBSDJail) { return; } -// take the first non-internal interface as the address for binding +// Take the first non-internal interface as the address for binding. +// Ideally, this should check for whether or not an interface is set up for +// BROADCAST and favor internal/private interfaces. get_bindAddress: for (var name in networkInterfaces) { var interfaces = networkInterfaces[name]; for (var i = 0; i < interfaces.length; i++) { @@ -209,7 +211,7 @@ if (process.argv[2] === 'child') { receivedMessages.push(buf); - process.send({ message: buf.toString() }); + process.send({message: buf.toString()}); if (receivedMessages.length == messages.length) { process.nextTick(function() { @@ -228,7 +230,7 @@ if (process.argv[2] === 'child') { }); listenSocket.on('listening', function() { - process.send({ listening: true }); + process.send({listening: true}); }); listenSocket.bind(common.PORT); |