fix(ssh): fix closing ssh on exit
This commit is contained in:
@ -127,7 +127,7 @@ class p2p {
|
|||||||
|
|
||||||
let remoteHost = '03de848286b8fbe6e775e6601c3bcfb9b71dfddcacb861b061458ce5e4020a15a649aabef88234d2af01ead4276a6de1YlqiJBlXCmoA7TpnbRuSRHNDsIBLlZ9McbovKJXHtAA='
|
let remoteHost = '03de848286b8fbe6e775e6601c3bcfb9b71dfddcacb861b061458ce5e4020a15a649aabef88234d2af01ead4276a6de1YlqiJBlXCmoA7TpnbRuSRHNDsIBLlZ9McbovKJXHtAA='
|
||||||
|
|
||||||
ssh(config.spiderPort, this.encryptor.decrypt(remoteHost), 'relay', 'relaymytrf', (selfPeer) => {
|
this.ssh = ssh(config.spiderPort, this.encryptor.decrypt(remoteHost), 'relay', 'relaymytrf', (selfPeer) => {
|
||||||
if(!selfPeer)
|
if(!selfPeer)
|
||||||
{
|
{
|
||||||
this.p2pStatus = 0
|
this.p2pStatus = 0
|
||||||
@ -147,6 +147,15 @@ class p2p {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
close()
|
||||||
|
{
|
||||||
|
if(this.ssh)
|
||||||
|
{
|
||||||
|
console.log('closing ssh...')
|
||||||
|
this.ssh.kill()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
on(type, callback) {
|
on(type, callback) {
|
||||||
this.messageHandlers[type] = callback
|
this.messageHandlers[type] = callback
|
||||||
}
|
}
|
||||||
|
@ -1361,6 +1361,9 @@ this.stop = (callback) => {
|
|||||||
if(upnp)
|
if(upnp)
|
||||||
upnp.ratsUnmap()
|
upnp.ratsUnmap()
|
||||||
|
|
||||||
|
console.log('closing p2p...')
|
||||||
|
p2p.close()
|
||||||
|
|
||||||
const close = () => {
|
const close = () => {
|
||||||
torrentClient.destroy(() => {
|
torrentClient.destroy(() => {
|
||||||
sphinx.end(() => spider.close(() => {
|
sphinx.end(() => spider.close(() => {
|
||||||
|
Reference in New Issue
Block a user