fix(linux): fix closing on linux in some cases

This commit is contained in:
Alexey Kasyanchuk 2018-08-12 04:34:41 +03:00
parent dba71624af
commit a4230874f5
2 changed files with 12 additions and 4 deletions

View File

@ -367,3 +367,8 @@ rl.on("SIGINT", function () {
process.on("SIGINT", () => { process.on("SIGINT", () => {
stop() stop()
}); });
process.on("exit", () => {
if(spider)
spider.preventNetworkOnExit = true
})

View File

@ -833,12 +833,15 @@ module.exports = function (send, recive, dataDirectory, version, env)
})) }))
}) })
if(!this.preventNetworkOnExit)
{
await Promise.all([ await Promise.all([
saveBootstrapPeers('api.myjson.com', '/bins/1e5rmh'), saveBootstrapPeers('api.myjson.com', '/bins/1e5rmh'),
saveBootstrapPeers('jsonblob.com', '/api/jsonBlob/013a4415-3533-11e8-8290-a901f3cf34aa') saveBootstrapPeers('jsonblob.com', '/api/jsonBlob/013a4415-3533-11e8-8290-a901f3cf34aa')
]) ])
} }
} }
}
logT('close', 'closing p2p...') logT('close', 'closing p2p...')
// don't listen spider peer appears // don't listen spider peer appears