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
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2015-07-16 06:59:33 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-07-16 06:59:33 +0300
commit5b6d25a6f8ab7e53502ebb0fb1462cd67f685948 (patch)
tree78c26b88e62d15dbab0c0a7f5e3d7fa35d86e867 /bin/cmd.js
parente3ae9d6ddfeddf8f37e42a25b25b4ae511219e0e (diff)
command line UI improvements
Diffstat (limited to 'bin/cmd.js')
-rwxr-xr-xbin/cmd.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/bin/cmd.js b/bin/cmd.js
index cbb7da5..18e1643 100755
--- a/bin/cmd.js
+++ b/bin/cmd.js
@@ -524,10 +524,10 @@ function drawTorrent (torrent) {
if (argv.verbose) {
var pieces = torrent.storage.pieces
- var storageMem = 0
+ var memoryUsage = 0
for (var i = 0; i < pieces.length; i++) {
var piece = pieces[i]
- if (piece.buffer) storageMem += piece.buffer.length
+ if (piece.buffer) memoryUsage += piece.buffer.length
if (piece.verified || (piece.blocksWritten === 0 && !piece.blocks[0])) continue
var bar = ''
for (var j = 0; j < piece.blocks.length; j++) {
@@ -547,7 +547,7 @@ function drawTorrent (torrent) {
linesRemaining -= 1
}
clivas.line(
- '{red:storage mem:} {bold:' + prettyBytes(storageMem) + ' KB} '
+ '{red:memory usage:} {bold:' + prettyBytes(memoryUsage) + '}'
)
clivas.line('{80:}')
linesRemaining -= 2
@@ -566,13 +566,17 @@ function drawTorrent (torrent) {
progress = bits === piececount ? 'S' : Math.floor(100 * bits / piececount) + '%'
}
var tags = []
+
if (wire.peerChoking) tags.push('choked')
- var reqStats = wire.requests.map(function (req) {
- return req.piece
- })
+ if (wire.requests.length > 0) tags.push(wire.requests.length + ' reqs')
+
+ var reqStats = argv.verbose
+ ? wire.requests.map(function (req) { return req.piece })
+ : []
+
clivas.line(
- '{3:%s} {25+magenta:%s} {10:%s} {10+cyan:%s/s} {10+red:%s/s} {15+grey:%s}' +
- '{15+cyan:%s}',
+ '{3:%s} {25+magenta:%s} {10:%s} {12+cyan:%s/s} {12+red:%s/s} {15+grey:%s}' +
+ '{10+grey:%s}',
progress,
wire.remoteAddress
? (wire.remoteAddress + ':' + wire.remotePort)