From c5ba778b95ff964ba1d414027e981473b9813e4e Mon Sep 17 00:00:00 2001 From: Torjus Date: Wed, 1 Aug 2018 13:37:24 +0200 Subject: [PATCH] Add timeout message when searching for peers --- app/lib/components/FileSharing/FileEntry.jsx | 28 +++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/app/lib/components/FileSharing/FileEntry.jsx b/app/lib/components/FileSharing/FileEntry.jsx index 4319cfa..e8f17b0 100644 --- a/app/lib/components/FileSharing/FileEntry.jsx +++ b/app/lib/components/FileSharing/FileEntry.jsx @@ -43,7 +43,8 @@ class FileEntry extends Component files : torrent.files, numPeers : torrent.numPeers, progress : 1, - active : false + active : false, + timeout : false }); return; @@ -90,6 +91,16 @@ class FileEntry extends Component } client.add(magnetURI, this.handleTorrent); + + setTimeout(() => + { + if (this.state.active && this.state.numPeers === 0) + { + this.setState({ + timeout : true + }); + } + }, 10 * 1000); } render() @@ -122,9 +133,18 @@ class FileEntry extends Component )} {this.state.active && this.state.numPeers === 0 && ( -

- Locating peers -

+ +

+ Locating peers +

+ + {this.state.timeout && ( +

+ 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. +

+ )} +
)} {this.state.active && this.state.numPeers > 0 && (