Skip to content

Commit

Permalink
fix(ssh): fix closing ssh on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
DEgITx committed Mar 17, 2018
1 parent 5b26500 commit 426886d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/background/p2p.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class p2p {

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)
{
this.p2pStatus = 0
Expand All @@ -147,6 +147,15 @@ class p2p {
})
}

close()
{
if(this.ssh)
{
console.log('closing ssh...')
this.ssh.kill()
}
}

on(type, callback) {
this.messageHandlers[type] = callback
}
Expand Down
3 changes: 3 additions & 0 deletions src/background/spider.js
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,9 @@ this.stop = (callback) => {
if(upnp)
upnp.ratsUnmap()

console.log('closing p2p...')
p2p.close()

const close = () => {
torrentClient.destroy(() => {
sphinx.end(() => spider.close(() => {
Expand Down

0 comments on commit 426886d

Please sign in to comment.