feat(p2p): peers backup on exit

This commit is contained in:
Alexey Kasyanchuk
2018-03-03 23:15:05 +03:00
parent a60beeaee3
commit 6de95a1add
6 changed files with 123 additions and 77 deletions

View File

@ -91,9 +91,16 @@ class App extends Component {
window.torrentSocket.on('peer', (numOfPeers) => {
window.peers = numOfPeers
console.log(window.peers)
this.forceUpdate()
})
window.torrentSocket.emit('peers', (numOfPeers) => {
if(numOfPeers > 0)
{
window.peers = numOfPeers
this.forceUpdate()
}
})
}
componentWillUnmount() {
appReady = false;