Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2016-01-10 19:10:48 +0300
committerFeross Aboukhadijeh <feross@feross.org>2016-01-11 02:08:59 +0300
commit427f2d3b7b6e6d1bbb19681f7515acd80cc60d61 (patch)
tree43aed47578fd49435ec8dcf4104c9999f5ff2669 /bin
parent37ecd873cb15ad33bd1897485ddc471ca42684a6 (diff)
cmd: use `torrent.numPeers` API
Diffstat (limited to 'bin')
-rwxr-xr-xbin/cmd.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/bin/cmd.js b/bin/cmd.js
index 457249a..311d358 100755
--- a/bin/cmd.js
+++ b/bin/cmd.js
@@ -299,7 +299,6 @@ function runDownload (torrentId) {
torrent.on('done', function () {
if (!argv.quiet) {
- // TODO: expose this data from bittorrent-swarm
var numActiveWires = torrent.swarm.wires.reduce(function (num, wire) {
return num + (wire.downloaded > 0)
}, 0)
@@ -307,7 +306,7 @@ function runDownload (torrentId) {
'torrent downloaded {green:successfully} from {bold:%s/%s} {green:peers} ' +
'in {bold:%ss}!',
numActiveWires,
- torrent.swarm.wires.length,
+ torrent.numPeers,
getRuntime()
)
}
@@ -535,7 +534,7 @@ function drawTorrent (torrent) {
line(
'{green:Running time:} {bold:' + getRuntime() + 's} ' +
'{green:Time remaining:} {bold:' + estimate + '} ' +
- '{green:Peers:} {bold:' + unchoked.length + '/' + torrent.swarm.wires.length + '}'
+ '{green:Peers:} {bold:' + unchoked.length + '/' + torrent.numPeers + '}'
)
if (argv.verbose) {
line(
@@ -583,9 +582,9 @@ function drawTorrent (torrent) {
return linesRemaining > 4
})
- if (torrent.swarm.wires.length > peerslisted) {
+ if (torrent.numPeers > peerslisted) {
line('{60:}')
- line('... and %s more', torrent.swarm.wires.length - peerslisted)
+ line('... and %s more', torrent.numPeers - peerslisted)
}
line('{60:}')