aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-cluster-dgram-2.js
diff options
context:
space:
mode:
authorSam Roberts <sam@strongloop.com>2015-01-10 04:25:07 +0100
committerBert Belder <bertbelder@gmail.com>2015-01-31 00:10:39 +0100
commit65b1e4f56f1f49dccd19b65dee2856df05b06c89 (patch)
treeea3603066a3f979309fdf9bf6827836ba9d5a9e6 /test/parallel/test-cluster-dgram-2.js
parent083c421b5ca08576897b5da396085a462010780e (diff)
downloadandroid-node-v8-65b1e4f56f1f49dccd19b65dee2856df05b06c89.tar.gz
android-node-v8-65b1e4f56f1f49dccd19b65dee2856df05b06c89.tar.bz2
android-node-v8-65b1e4f56f1f49dccd19b65dee2856df05b06c89.zip
dgram: implicit binds should be exclusive
Server sockets should be shared by default, and client sockets should be exclusive by default. For net/TCP, this is how it is, for dgram/UDP, its a little less clear what a client socket is, but a socket that is auto-bound during a dgram.send() is not usefully shared among cluster workers, any more than an outgoing TCP connection would be usefully shared. Since implicit binds become exclusive, implicit/client dgram sockets can now be used with cluster on Windows. Before, neither explicit nor implicitly bound sockets could be used, causing dgram to be completely unsupported with cluster on Windows. After this change, they become half supported. PR: https://github.com/iojs/io.js/pull/325 PR: https://github.com/joyent/node/pull/8643 Reviewed-by: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-by: Bert Belder <bertbelder@gmail.com>
Diffstat (limited to 'test/parallel/test-cluster-dgram-2.js')
-rw-r--r--test/parallel/test-cluster-dgram-2.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/parallel/test-cluster-dgram-2.js b/test/parallel/test-cluster-dgram-2.js
index 6b88a18dc2..68de38e7c3 100644
--- a/test/parallel/test-cluster-dgram-2.js
+++ b/test/parallel/test-cluster-dgram-2.js
@@ -53,6 +53,11 @@ function worker() {
var socket = dgram.createSocket('udp4');
var buf = new Buffer('hello world');
+ // This test is intended to exercise the cluster binding of udp sockets, but
+ // since sockets aren't clustered when implicitly bound by at first call of
+ // send(), explicitly bind them to an ephemeral port.
+ socket.bind(0);
+
for (var i = 0; i < PACKETS_PER_WORKER; i++)
socket.send(buf, 0, buf.length, common.PORT, '127.0.0.1');