summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/dgram.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/dgram.js b/lib/dgram.js
index d5c2e0da69..4166b026e1 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;
};