diff --git a/lib/dgram.js b/lib/dgram.js index d5c2e0da69c..4166b026e1b 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -237,11 +237,15 @@ Socket.prototype.setTTL = function(arg) { Socket.prototype.setMulticastTTL = function(arg) { - if (this._handle.setMulticastTTL(arg) == -1) { + if (typeof arg !== 'number') { + throw new TypeError('Argument must be a number'); + } + + if (this._handle.setMulticastTTL(arg)) { throw errnoException(errno, 'setMulticastTTL'); } - return true; + return arg; };