diff --git a/extras/rpc-spec.txt b/extras/rpc-spec.txt index 72ddbe968..ceb08a434 100644 --- a/extras/rpc-spec.txt +++ b/extras/rpc-spec.txt @@ -182,8 +182,8 @@ pieceCount | number | tr_info pieceSize | number | tr_info priorities | array (see below) | n/a - rateDownload (KBps) | double | tr_stat - rateUpload (KBps) | double | tr_stat + rateDownload (B/s) | number | tr_stat + rateUpload (B/s) | number | tr_stat recheckProgress | double | tr_stat seedIdleLimit | number | tr_torrent seedIdleMode | number | tr_inactvelimit @@ -235,8 +235,8 @@ | peerIsInterested | boolean | tr_peer_stat | port | number | tr_peer_stat | progress | double | tr_peer_stat - | rateToClient (KBps) | double | tr_peer_stat - | rateToPeer (KBps) | double | tr_peer_stat + | rateToClient (B/s) | number | tr_peer_stat + | rateToPeer (B/s) | number | tr_peer_stat -------------------+--------------------------------------+ peersFrom | an object containing: | +-------------------------+------------+ @@ -624,5 +624,3 @@ | | yes | session-get | new arg "idle-seeding-limit-enabled" | | yes | torrent-set | new arg "seedIdleLimit" | | yes | torrent-set | new arg "seedIdleMode" - | | NO | torrent-get | units for "rateDownload" changed from B to KB - | | NO | torrent-get | units for "rateUpload" changed from B to KB diff --git a/libtransmission/announcer.c b/libtransmission/announcer.c index 261a11c97..ee070ddb5 100644 --- a/libtransmission/announcer.c +++ b/libtransmission/announcer.c @@ -1993,10 +1993,13 @@ tr_announcerStats( const tr_torrent * torrent, st->id = tracker->id; tr_strlcpy( st->host, tracker->host->name, sizeof( st->host ) ); tr_strlcpy( st->announce, tracker->announce, sizeof( st->announce ) ); - tr_strlcpy( st->scrape, tracker->scrape, sizeof( st->scrape ) ); st->tier = i; st->isBackup = tracker != tier->currentTracker; st->lastScrapeStartTime = tier->lastScrapeStartTime; + if( tracker->scrape ) + tr_strlcpy( st->scrape, tracker->scrape, sizeof( st->scrape ) ); + else + st->scrape[0] = '\0'; st->seederCount = tracker->seederCount; st->leecherCount = tracker->leecherCount; diff --git a/libtransmission/rpcimpl.c b/libtransmission/rpcimpl.c index e0cb4c539..c2937d2ff 100644 --- a/libtransmission/rpcimpl.c +++ b/libtransmission/rpcimpl.c @@ -443,8 +443,8 @@ addPeers( const tr_torrent * tor, tr_bencDictAddBool( d, "peerIsInterested", peer->peerIsInterested ); tr_bencDictAddInt ( d, "port", peer->port ); tr_bencDictAddReal( d, "progress", peer->progress ); - tr_bencDictAddReal( d, "rateToClient", peer->rateToClient_KBps ); - tr_bencDictAddReal( d, "rateToPeer", peer->rateToPeer_KBps ); + tr_bencDictAddInt ( d, "rateToClient", toSpeedBytes( peer->rateToClient_KBps ) ); + tr_bencDictAddInt ( d, "rateToPeer", toSpeedBytes( peer->rateToPeer_KBps ) ); } tr_torrentPeersFree( peers, peerCount ); @@ -570,9 +570,9 @@ addField( const tr_torrent * tor, tr_benc * d, const char * key ) tr_bencListAddInt( p, inf->files[i].priority ); } else if( tr_streq( key, keylen, "rateDownload" ) ) - tr_bencDictAddReal( d, key, st->pieceDownloadSpeed_KBps ); + tr_bencDictAddInt( d, key, toSpeedBytes( st->pieceDownloadSpeed_KBps ) ); else if( tr_streq( key, keylen, "rateUpload" ) ) - tr_bencDictAddReal( d, key, st->pieceUploadSpeed_KBps ); + tr_bencDictAddInt( d, key, toSpeedBytes( st->pieceUploadSpeed_KBps ) ); else if( tr_streq( key, keylen, "recheckProgress" ) ) tr_bencDictAddReal( d, key, st->recheckProgress ); else if( tr_streq( key, keylen, "seedIdleLimit" ) ) diff --git a/qt/torrent.cc b/qt/torrent.cc index b24cc3777..f396ce13e 100644 --- a/qt/torrent.cc +++ b/qt/torrent.cc @@ -55,8 +55,8 @@ Torrent :: Property Torrent :: myProperties[] = { { ID, "id", QVariant::Int, INFO, }, - { UPLOAD_SPEED, "rateUpload", QVariant::Double, STAT } /* KBps */, - { DOWNLOAD_SPEED, "rateDownload", QVariant::Double, STAT }, /* KBps */ + { UPLOAD_SPEED, "rateUpload", QVariant::ULongLong, STAT } /* Bps */, + { DOWNLOAD_SPEED, "rateDownload", QVariant::ULongLong, STAT }, /* Bps */ { DOWNLOAD_DIR, "downloadDir", QVariant::String, STAT }, { ACTIVITY, "status", QVariant::Int, STAT }, { NAME, "name", QVariant::String, INFO }, @@ -662,10 +662,10 @@ Torrent :: update( tr_benc * d ) peer.port = i; if( tr_bencDictFindReal( child, "progress", &d ) ) peer.progress = d; - if( tr_bencDictFindReal( child, "rateToClient", &d ) ) - peer.rateToClient = Speed::fromKBps( d ); - if( tr_bencDictFindReal( child, "rateToPeer", &d ) ) - peer.rateToPeer = Speed::fromKBps( d ); + if( tr_bencDictFindInt( child, "rateToClient", &i ) ) + peer.rateToClient = Speed::fromBps( i ); + if( tr_bencDictFindInt( child, "rateToPeer", &i ) ) + peer.rateToPeer = Speed::fromBps( i ); peerList << peer; } myValues[PEERS].setValue( peerList ); diff --git a/qt/torrent.h b/qt/torrent.h index d3e2747bf..211f94910 100644 --- a/qt/torrent.h +++ b/qt/torrent.h @@ -283,8 +283,8 @@ class Torrent: public QObject bool isUploading( ) const { return peersWeAreUploadingTo( ) > 0; } int connectedPeers( ) const { return getInt( PEERS_CONNECTED ); } int connectedPeersAndWebseeds( ) const { return connectedPeers( ) + getInt( WEBSEEDS_SENDING_TO_US ); } - Speed downloadSpeed( ) const { return Speed::fromKBps( getDouble( DOWNLOAD_SPEED ) ); } - Speed uploadSpeed( ) const { return Speed::fromKBps( getDouble( UPLOAD_SPEED ) ); } + Speed downloadSpeed( ) const { return Speed::fromBps( getSize( DOWNLOAD_SPEED ) ); } + Speed uploadSpeed( ) const { return Speed::fromBps( getSize( UPLOAD_SPEED ) ); } double getVerifyProgress( ) const { return getDouble( PERCENT_VERIFIED ); } bool hasFileSubstring( const QString& substr ) const; bool hasTrackerSubstring( const QString& substr ) const;