diff options
Diffstat (limited to 'lib/dgram.js')
-rw-r--r-- | lib/dgram.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/dgram.js b/lib/dgram.js index 549b6dd738d..55662313d64 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -54,7 +54,11 @@ const { } = require('internal/async_hooks'); const { UV_UDP_REUSEADDR } = internalBinding('constants').os; -const { UDP, SendWrap } = internalBinding('udp_wrap'); +const { + constants: { UV_UDP_IPV6ONLY }, + UDP, + SendWrap +} = internalBinding('udp_wrap'); const BIND_STATE_UNBOUND = 0; const BIND_STATE_BINDING = 1; @@ -99,6 +103,7 @@ function Socket(type, listener) { bindState: BIND_STATE_UNBOUND, queue: undefined, reuseAddr: options && options.reuseAddr, // Use UV_UDP_REUSEADDR if true. + ipv6Only: options && options.ipv6Only, recvBufferSize, sendBufferSize }; @@ -270,6 +275,8 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) { var flags = 0; if (state.reuseAddr) flags |= UV_UDP_REUSEADDR; + if (state.ipv6Only) + flags |= UV_UDP_IPV6ONLY; if (cluster.isWorker && !exclusive) { bindServerHandle(this, { |