Add timeout message when searching for peers

master
Torjus 2018-08-01 13:37:24 +02:00
parent 57fba6c8ed
commit c5ba778b95
1 changed files with 24 additions and 4 deletions

View File

@ -43,7 +43,8 @@ class FileEntry extends Component
files : torrent.files, files : torrent.files,
numPeers : torrent.numPeers, numPeers : torrent.numPeers,
progress : 1, progress : 1,
active : false active : false,
timeout : false
}); });
return; return;
@ -90,6 +91,16 @@ class FileEntry extends Component
} }
client.add(magnetURI, this.handleTorrent); client.add(magnetURI, this.handleTorrent);
setTimeout(() =>
{
if (this.state.active && this.state.numPeers === 0)
{
this.setState({
timeout : true
});
}
}, 10 * 1000);
} }
render() render()
@ -122,9 +133,18 @@ class FileEntry extends Component
)} )}
{this.state.active && this.state.numPeers === 0 && ( {this.state.active && this.state.numPeers === 0 && (
<Fragment>
<p> <p>
Locating peers Locating peers
</p> </p>
{this.state.timeout && (
<p>
If this process takes a long time, there might not be anyone seeding
this torrent. Try asking someone to reupload the file that you want.
</p>
)}
</Fragment>
)} )}
{this.state.active && this.state.numPeers > 0 && ( {this.state.active && this.state.numPeers > 0 && (