Compare commits

..

No commits in common. "master" and "v1.0.0" have entirely different histories.

3 changed files with 2 additions and 12 deletions

View File

@ -91,9 +91,7 @@ function initNet(peer, config) {
async function start() { async function start() {
await stats.loaded() await stats.loaded()
glue(infos, connections) glue(infos, connections)
queueMicrotask(() => scheduler.start.bind(scheduler)((err) => { queueMicrotask(() => scheduler.start.bind(scheduler))
if (err) console.error("pzp-net scheduler start failed:", err)
}))
} }
function stop() { function stop() {

View File

@ -1,6 +1,6 @@
{ {
"name": "pzp-net", "name": "pzp-net",
"version": "1.0.1", "version": "1.0.0",
"description": "PZP plugin to manage connections with hubs and peers", "description": "PZP plugin to manage connections with hubs and peers",
"author": "Andre Staltz <contact@staltz.com>", "author": "Andre Staltz <contact@staltz.com>",
"license": "MIT", "license": "MIT",

View File

@ -62,9 +62,6 @@ test('Glueing together stats with connections', async (t) => {
while (FS.existsSync(statsJSONPath) === false) { while (FS.existsSync(statsJSONPath) === false) {
await p(setTimeout)(1) await p(setTimeout)(1)
} }
await p(setTimeout)(2000)
const fileContents = FS.readFileSync(statsJSONPath, 'utf8') const fileContents = FS.readFileSync(statsJSONPath, 'utf8')
const json = JSON.parse(fileContents) const json = JSON.parse(fileContents)
assert.deepEqual(Object.keys(json), [TEST_ADDR]) assert.deepEqual(Object.keys(json), [TEST_ADDR])
@ -104,17 +101,12 @@ test('Glueing together stats with connections', async (t) => {
while (FS.existsSync(statsJSONPath) === false) { while (FS.existsSync(statsJSONPath) === false) {
await p(setTimeout)(1) await p(setTimeout)(1)
} }
await p(setTimeout)(1000)
const fileContents = FS.readFileSync(statsJSONPath, 'utf8') const fileContents = FS.readFileSync(statsJSONPath, 'utf8')
assert.equal(fileContents.length > 10, true, 'stats.json is not empty') assert.equal(fileContents.length > 10, true, 'stats.json is not empty')
peer.net.forget(address) peer.net.forget(address)
await p(setTimeout)(200) await p(setTimeout)(200)
await p(setTimeout)(1000)
const entriesAfterForget = await p(peer.net.peers())(null) const entriesAfterForget = await p(peer.net.peers())(null)
assert.equal(entriesAfterForget.length, 0, 'there is no entry in peers()') assert.equal(entriesAfterForget.length, 0, 'there is no entry in peers()')