1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 01:27:28 +00:00

(trunk daemon) #1707: Show peer progress in --peers view

This commit is contained in:
Charles Kerr 2009-01-17 16:44:16 +00:00
parent c1e1fedff9
commit c512ca3f91

View file

@ -963,21 +963,24 @@ static void
printPeersImpl( tr_benc * peers ) printPeersImpl( tr_benc * peers )
{ {
int i, n; int i, n;
printf( "%-20s %-12s %-6s %-6s %s\n", printf( "%-20s %-12s %-5s %-6s %-6s %s\n",
"Address", "Flags", "Down", "Up", "Client" ); "Address", "Flags", "Done", "Down", "Up", "Client" );
for( i = 0, n = tr_bencListSize( peers ); i < n; ++i ) for( i = 0, n = tr_bencListSize( peers ); i < n; ++i )
{ {
double progress;
const char * address, * client, * flagstr; const char * address, * client, * flagstr;
int64_t rateToClient, rateToPeer; int64_t rateToClient, rateToPeer;
tr_benc * d = tr_bencListChild( peers, i ); tr_benc * d = tr_bencListChild( peers, i );
if( tr_bencDictFindStr( d, "address", &address ) if( tr_bencDictFindStr( d, "address", &address )
&& tr_bencDictFindStr( d, "clientName", &client ) && tr_bencDictFindStr( d, "clientName", &client )
&& tr_bencDictFindDouble( d, "progress", &progress )
&& tr_bencDictFindStr( d, "flagStr", &flagstr ) && tr_bencDictFindStr( d, "flagStr", &flagstr )
&& tr_bencDictFindInt( d, "rateToClient", &rateToClient ) && tr_bencDictFindInt( d, "rateToClient", &rateToClient )
&& tr_bencDictFindInt( d, "rateToPeer", &rateToPeer ) ) && tr_bencDictFindInt( d, "rateToPeer", &rateToPeer ) )
{ {
printf( "%-20s %-12s %6.1f %6.1f %s\n", printf( "%-20s %-12s %-5.1f %6.1f %6.1f %s\n",
address, flagstr, address, flagstr, (progress*100.0),
rateToClient / 1024.0, rateToClient / 1024.0,
rateToPeer / 1024.0, rateToPeer / 1024.0,
client ); client );