corestore 6.4.2 → 6.4.3
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.
- package/index.js +5 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -263,12 +263,15 @@ module.exports = class Corestore extends EventEmitter {
|
|
|
263
263
|
this._findingPeers.push(core.findingPeers())
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
-
|
|
266
|
+
const gc = () => {
|
|
267
267
|
// technically better to also clear _findingPeers if we added it,
|
|
268
268
|
// but the lifecycle for those are pretty short so prob not worth the complexity
|
|
269
269
|
// as _decFindingPeers clear them all.
|
|
270
270
|
this._sessions.delete(core)
|
|
271
|
-
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
core.ready().catch(gc)
|
|
274
|
+
core.once('close', gc)
|
|
272
275
|
|
|
273
276
|
return core
|
|
274
277
|
}
|