Compare commits

...

6 Commits

Author SHA1 Message Date
achingbrain
ef54e0a10e chore: release version v0.35.8 2021-12-29 11:00:11 +01:00
achingbrain
61bf546c46 chore: update contributors 2021-12-29 11:00:11 +01:00
Alex Potsides
d2b7ec0f6b fix: look for final peer event instead of peer response (#1092)
`FINAL_PEER` means we found the peer, `PEER_RESPONSE` means a peer
responded to our query.
2021-12-29 10:56:56 +01:00
Alex Potsides
79b3cfc6ad fix: do not wait for autodial start (#1089)
When we've previously seen loads of peers and stored them in the
datastore we'll try to dial them as part of starting the autodial
component.

If we or our peers have bad network connections this can make
starting a libp2p node take ages so don't wait for a round of auto
dialing before considering the component started.
2021-12-29 10:55:48 +01:00
Alex Potsides
f18fc80b70 fix: increase listeners on any-signal (#1084)
Increase the number of listeners we allow on the actual signal we pass along, instead of the signal we pass into any-signal.
2021-12-29 10:51:26 +01:00
Alex Potsides
b4b432406e fix: record tracked map clears (#1085)
Record the size of a map after we `.clear()` it.
2021-12-27 07:14:27 +01:00
6 changed files with 30 additions and 13 deletions

View File

@@ -1,3 +1,15 @@
## [0.35.8](https://github.com/libp2p/js-libp2p/compare/v0.35.7...v0.35.8) (2021-12-29)
### Bug Fixes
* do not wait for autodial start ([#1089](https://github.com/libp2p/js-libp2p/issues/1089)) ([79b3cfc](https://github.com/libp2p/js-libp2p/commit/79b3cfc6ad02ecc76fe23a3c3ff2d0b32a0ae4a8))
* increase listeners on any-signal ([#1084](https://github.com/libp2p/js-libp2p/issues/1084)) ([f18fc80](https://github.com/libp2p/js-libp2p/commit/f18fc80b70bf7b6b26fffa70b0a8d0502a6c4801))
* look for final peer event instead of peer response ([#1092](https://github.com/libp2p/js-libp2p/issues/1092)) ([d2b7ec0](https://github.com/libp2p/js-libp2p/commit/d2b7ec0f6be0ee80f2c963279a8ec2385059a889))
* record tracked map clears ([#1085](https://github.com/libp2p/js-libp2p/issues/1085)) ([b4b4324](https://github.com/libp2p/js-libp2p/commit/b4b432406ebc08ef2fc3a1922c64cde7c9060cae))
## [0.35.7](https://github.com/libp2p/js-libp2p/compare/v0.35.2...v0.35.7) (2021-12-24) ## [0.35.7](https://github.com/libp2p/js-libp2p/compare/v0.35.2...v0.35.7) (2021-12-24)

View File

@@ -1,6 +1,6 @@
{ {
"name": "libp2p", "name": "libp2p",
"version": "0.35.7", "version": "0.35.8",
"description": "JavaScript implementation of libp2p, a modular peer to peer network stack", "description": "JavaScript implementation of libp2p, a modular peer to peer network stack",
"leadMaintainer": "Jacob Heun <jacobheun@gmail.com>", "leadMaintainer": "Jacob Heun <jacobheun@gmail.com>",
"main": "src/index.js", "main": "src/index.js",
@@ -181,12 +181,12 @@
"Friedel Ziegelmayer <dignifiedquire@gmail.com>", "Friedel Ziegelmayer <dignifiedquire@gmail.com>",
"Maciej Krüger <mkg20001@gmail.com>", "Maciej Krüger <mkg20001@gmail.com>",
"Hugo Dias <mail@hugodias.me>", "Hugo Dias <mail@hugodias.me>",
"dirkmc <dirkmdev@gmail.com>",
"Volker Mische <volker.mische@gmail.com>", "Volker Mische <volker.mische@gmail.com>",
"Chris Dostert <chrisdostert@users.noreply.github.com>", "Chris Dostert <chrisdostert@users.noreply.github.com>",
"dirkmc <dirkmdev@gmail.com>", "zeim839 <50573884+zeim839@users.noreply.github.com>",
"Robert Kiel <robert.kiel@hoprnet.org>", "Robert Kiel <robert.kiel@hoprnet.org>",
"Richard Littauer <richard.littauer@gmail.com>", "Richard Littauer <richard.littauer@gmail.com>",
"zeim839 <50573884+zeim839@users.noreply.github.com>",
"a1300 <matthias-knopp@gmx.net>", "a1300 <matthias-knopp@gmx.net>",
"Ryan Bell <ryan@piing.net>", "Ryan Bell <ryan@piing.net>",
"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <victorbjelkholm@gmail.com>", "ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <victorbjelkholm@gmail.com>",

View File

@@ -57,7 +57,9 @@ class AutoDialler {
} }
this._running = true this._running = true
this._autoDial() this._autoDial().catch(err => {
log.error('could start autodial', err)
})
log('started') log('started')
} }

View File

@@ -27,12 +27,8 @@ class DHTPeerRouting {
*/ */
async findPeer (peerId, options = {}) { async findPeer (peerId, options = {}) {
for await (const event of this._dht.findPeer(peerId, options)) { for await (const event of this._dht.findPeer(peerId, options)) {
if (event.name === 'PEER_RESPONSE') { if (event.name === 'FINAL_PEER') {
const peer = event.closer.find(peerData => peerData.id.equals(peerId)) return event.peer
if (peer) {
return peer
}
} }
} }

View File

@@ -252,14 +252,15 @@ class Dialer {
// Combine the timeout signal and options.signal, if provided // Combine the timeout signal and options.signal, if provided
const timeoutController = new TimeoutController(this.timeout) const timeoutController = new TimeoutController(this.timeout)
// this controller will potentially be used while dialing lots of
// peers so prevent MaxListenersExceededWarning appearing in the console
setMaxListeners && setMaxListeners(Infinity, timeoutController.signal)
const signals = [timeoutController.signal] const signals = [timeoutController.signal]
options.signal && signals.push(options.signal) options.signal && signals.push(options.signal)
const signal = anySignal(signals) const signal = anySignal(signals)
// this signal will potentially be used while dialing lots of
// peers so prevent MaxListenersExceededWarning appearing in the console
setMaxListeners && setMaxListeners(Infinity, signal)
const pendingDial = { const pendingDial = {
dialRequest, dialRequest,
controller: timeoutController, controller: timeoutController,

View File

@@ -38,6 +38,12 @@ class TrackedMap extends Map {
this._metrics.updateComponentMetric(this._component, this._name, this.size) this._metrics.updateComponentMetric(this._component, this._name, this.size)
return deleted return deleted
} }
clear () {
super.clear()
this._metrics.updateComponentMetric(this._component, this._name, this.size)
}
} }
/** /**