Comparing version 0.4.2 to 0.4.3
18
index.js
@@ -7,3 +7,3 @@ /* | ||
Copyright (c) 2013-2014 Tristan Slominski | ||
Copyright (c) 2013-2015 Tristan Slominski | ||
@@ -317,4 +317,16 @@ Permission is hereby granted, free of charge, to any person | ||
var self = this; | ||
self.low = new KBucket({localNodeId: self.localNodeId, root: self.root}); | ||
self.high = new KBucket({localNodeId: self.localNodeId, root: self.root}); | ||
self.low = new KBucket({ | ||
arbiter: self.arbiter, | ||
localNodeId: self.localNodeId, | ||
root: self.root, | ||
numberOfNodesPerKBucket: self.numberOfNodesPerKBucket, | ||
numberOfNodesToPing: self.numberOfNodesToPing | ||
}); | ||
self.high = new KBucket({ | ||
arbiter: self.arbiter, | ||
localNodeId: self.localNodeId, | ||
root: self.root, | ||
numberOfNodesPerKBucket: self.numberOfNodesPerKBucket, | ||
numberOfNodesToPing: self.numberOfNodesToPing | ||
}); | ||
@@ -321,0 +333,0 @@ bitIndex = bitIndex || 0; |
{ | ||
"name": "k-bucket", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "Kademlia DHT K-bucket implementation as a binary tree", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -11,3 +11,3 @@ # k-bucket | ||
[@tristanls](https://github.com/tristanls), [@mikedeboer](https://github.com/mikedeboer), [@deoxxa](https://github.com/deoxxa), [@feross](https://github.com/feross) | ||
[@tristanls](https://github.com/tristanls), [@mikedeboer](https://github.com/mikedeboer), [@deoxxa](https://github.com/deoxxa), [@feross](https://github.com/feross), [@nathanph](https://github.com/nathanph) | ||
@@ -14,0 +14,0 @@ ## Installation |
@@ -43,2 +43,21 @@ "use strict"; | ||
test['split buckets inherit options from parent bucket'] = function (test) { | ||
var OPTIONS = ['arbiter', 'localNodeId', 'root', 'numberOfNodesPerKBucket', | ||
'numberOfNodesToPing']; | ||
test.expect(2 * OPTIONS.length); | ||
var kBucket = new KBucket(); | ||
var _options = {}; | ||
OPTIONS.forEach(function(option){ | ||
_options[option] = kBucket[option]; | ||
}); | ||
for (var i = 0; i < kBucket.numberOfNodesPerKBucket + 1; i++) { | ||
kBucket.add({id: new Buffer("" + i)}); | ||
} | ||
OPTIONS.forEach(function(option){ | ||
test.strictEqual(kBucket.low[option], _options[option]); | ||
test.strictEqual(kBucket.high[option], _options[option]); | ||
}); | ||
test.done(); | ||
}; | ||
test['split buckets contain all added contacts'] = function (test) { | ||
@@ -104,2 +123,2 @@ test.expect(20 /*numberOfNodesPerKBucket*/ + 2); | ||
test.done(); | ||
}; | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54841
945