kademlia-routing-table 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +4 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -22,12 +22,11 @@ module.exports = class RoutingTable extends EventEmitter {
22
22
  this.emit('row', row)
23
23
  }
24
24
 
25
- if (row.add(node, this.k)) {
26
- this.size++
27
- return true
28
- }
25
+ const len = row.nodes.length
26
+ if (!row.add(node, this.k)) return false
29
27
 
30
- return false
28
+ this.size += row.nodes.length - len
29
+ return true
31
30
  }
32
31
 
33
32
  remove (id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kademlia-routing-table",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "XOR based routing table used for P2P networks such as a Kademlia DHT.",
5
5
  "main": "index.js",
6
6
  "imports": {