Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2012-01-24 00:09:56 +0400
committerBen Noordhuis <info@bnoordhuis.nl>2012-01-24 03:05:34 +0400
commited111975a096cb44a7d737e46c6e0c73025e0670 (patch)
treee48a62d4f2c7456fc5050f2df8fff496044f2466 /lib
parentf33a35e293fb51dc5644d514b154564ad330baa4 (diff)
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).
Diffstat (limited to 'lib')
-rw-r--r--lib/dgram.js8
1 files changed, 6 insertions, 2 deletions
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;
};