(trunk libT) add a bool to tr_peer_stat and the RPC peer list to denote whether or not a peer's connected via µTP

This commit is contained in:
Jordan Lee 2011-02-18 04:07:43 +00:00
parent 224815b010
commit 80d06d4c34
4 changed files with 9 additions and 2 deletions

View File

@ -231,6 +231,7 @@
| isEncrypted | boolean | tr_peer_stat
| isIncoming | boolean | tr_peer_stat
| isUploadingTo | boolean | tr_peer_stat
| isUTP | boolean | tr_peer_stat
| peerIsChoked | boolean | tr_peer_stat
| peerIsInterested | boolean | tr_peer_stat
| port | number | tr_peer_stat
@ -653,3 +654,5 @@
------+---------+-----------+----------------+-------------------------------
12 | 2.20 | yes | session-get | new arg "download-dir-free-space"
| | yes | session-close | new method
------+---------+-----------+----------------+-------------------------------
13 | 2.30 | yes | session-get | new arg "isUTP" to the "peers" list

View File

@ -2624,6 +2624,7 @@ tr_peerMgrPeerStats( const tr_torrent * tor, int * setmeCount )
stat->port = ntohs( peer->atom->port );
stat->from = atom->fromFirst;
stat->progress = peer->progress;
stat->isUTP = peer->io->utp_socket != NULL;
stat->isEncrypted = tr_peerIoIsEncrypted( peer->io ) ? 1 : 0;
stat->rateToPeer_KBps = toSpeedKBps( tr_peerGetPieceSpeed_Bps( peer, now_msec, TR_CLIENT_TO_PEER ) );
stat->rateToClient_KBps = toSpeedKBps( tr_peerGetPieceSpeed_Bps( peer, now_msec, TR_PEER_TO_CLIENT ) );
@ -2645,7 +2646,7 @@ tr_peerMgrPeerStats( const tr_torrent * tor, int * setmeCount )
stat->pendingReqsToClient = peer->pendingReqsToClient;
pch = stat->flagStr;
if( peer->io->utp_socket != NULL) *pch++ = 'T';
if( stat->isUTP ) *pch++ = 'T';
if( t->optimistic == peer ) *pch++ = 'O';
if( stat->isDownloadingFrom ) *pch++ = 'D';
else if( stat->clientIsInterested ) *pch++ = 'd';

View File

@ -36,7 +36,7 @@
#include "version.h"
#include "web.h"
#define RPC_VERSION 11
#define RPC_VERSION 13
#define RPC_VERSION_MIN 1
#define RECENTLY_ACTIVE_SECONDS 60
@ -446,6 +446,7 @@ addPeers( const tr_torrent * tor,
tr_bencDictAddBool( d, "isEncrypted", peer->isEncrypted );
tr_bencDictAddBool( d, "isIncoming", peer->isIncoming );
tr_bencDictAddBool( d, "isUploadingTo", peer->isUploadingTo );
tr_bencDictAddBool( d, "isUTP", peer->isUTP );
tr_bencDictAddBool( d, "peerIsChoked", peer->peerIsChoked );
tr_bencDictAddBool( d, "peerIsInterested", peer->peerIsInterested );
tr_bencDictAddInt ( d, "port", peer->port );

View File

@ -1394,6 +1394,8 @@ tr_bool tr_torrentCanManualUpdate( const tr_torrent * torrent );
typedef struct tr_peer_stat
{
tr_bool isUTP;
tr_bool isEncrypted;
tr_bool isDownloadingFrom;
tr_bool isUploadingTo;