Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

dgram: make setMulticastTTL() conform to v0.4 API

- throw if the ttl argument is not a number
- return the ttl argument (not particulary useful but it's what v0.4 did)

Note that the 0 < ttl < 256 check has *not* been reinstated. On Linux, -1 is a
valid argument to setsockopt(IPPROTO_IP, IP_TTL).
  • Loading branch information...
commit ed111975a096cb44a7d737e46c6e0c73025e0670 1 parent f33a35e
@bnoordhuis bnoordhuis authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/dgram.js
View
8 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;
};
Please sign in to comment.
Something went wrong with that request. Please try again.