diff options
author | Sam Roberts <sam@strongloop.com> | 2015-01-10 04:25:07 +0100 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2015-01-10 04:50:50 +0100 |
commit | a32b92dbcfc8a3a8b2409bb2ace2233ebe327888 (patch) | |
tree | f703b18d52bac11bf0408b6c1e414d0f2dce071c /lib/dgram.js | |
parent | 092c224e08994e06cb64219ae371f32c477ea3bf (diff) | |
download | nodejs-a32b92dbcfc8a3a8b2409bb2ace2233ebe327888.tar.gz nodejs-a32b92dbcfc8a3a8b2409bb2ace2233ebe327888.tar.bz2 nodejs-a32b92dbcfc8a3a8b2409bb2ace2233ebe327888.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-URL: https://github.com/joyent/node/pull/8643
Reviewed-by: Bert Belder <bertbelder@gmail.com>
Diffstat (limited to 'lib/dgram.js')
-rw-r--r-- | lib/dgram.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/dgram.js b/lib/dgram.js index 62d004cc0..5151965b8 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -299,7 +299,7 @@ Socket.prototype.send = function(buffer, self._healthCheck(); if (self._bindState == BIND_STATE_UNBOUND) - self.bind(0, null); + self.bind({port: 0, exclusive: true}, null); // If the socket hasn't been bound yet, push the outbound packet onto the // send queue and send after binding is complete. |