diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2016-01-10 19:10:48 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2016-01-11 02:08:59 +0300 |
commit | 427f2d3b7b6e6d1bbb19681f7515acd80cc60d61 (patch) | |
tree | 43aed47578fd49435ec8dcf4104c9999f5ff2669 /bin | |
parent | 37ecd873cb15ad33bd1897485ddc471ca42684a6 (diff) |
cmd: use `torrent.numPeers` API
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cmd.js | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -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:}') |