diff --git a/src/node_modules/_datdot-service-helpers/done-task-cleanup.js b/src/node_modules/_datdot-service-helpers/done-task-cleanup.js index 79e4db0e..f5b5f1e7 100644 --- a/src/node_modules/_datdot-service-helpers/done-task-cleanup.js +++ b/src/node_modules/_datdot-service-helpers/done-task-cleanup.js @@ -77,7 +77,7 @@ async function done_task_cleanup ({ role, topic, remotestringkey, peers, state, close_feeds({ feeds, field, log }) if (!topic_tasks) { remove_from_tasks({ tasks, stringtopic, log }) - destroy_swarm({ state, log }) + await destroy_swarm({ state, log }) } } else { remove_from_tasks({ tasks, stringtopic, log }) @@ -287,10 +287,9 @@ function set_status_for_connection ({ status, tasks, stringtopic, remotestringke tasks[stringtopic].connections[remotestringkey] = { status } } -function destroy_swarm ({ state, log }) { +async function destroy_swarm ({ state, log }) { const { swarm } = state - swarm.dht._listening = false - swarm.dht.destroy() + await swarm.destroy({ force: true }) delete state.swarm log({ type: 'cleanup', data: { text: 'swarm destroyed' }}) } \ No newline at end of file diff --git a/src/roles/hoster.js b/src/roles/hoster.js index 6609cb40..3e5446cd 100644 --- a/src/roles/hoster.js +++ b/src/roles/hoster.js @@ -339,6 +339,7 @@ async function handle_hosterReplacement (args) { async function send_data_to_attester (opts) { return new Promise (async (resolve, reject) => { const { account, hyper, hosterkey, attesterkey, feedkey, ranges, id, tid, log } = opts + const pubkey = account.noisePublicKey.toString('hex') const topic = derive_topic({ senderKey: hosterkey, feedkey, receiverKey: attesterkey, id, log }) const { feed } = await hyper.new_task({ topic, log }) log({ type: 'hoster', data: { text: `New task added (active hoster)` } })