From: Jordan Lee Date: Fri, 18 Feb 2011 04:07:43 +0000 (+0000) Subject: (trunk libT) add a bool to tr_peer_stat and the RPC peer list to denote whether or... X-Git-Tag: 2.30b1~285 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=80d06d4c346c4020dd92fe166cb55e7f33992da8;p=transmission (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 --- diff --git a/extras/rpc-spec.txt b/extras/rpc-spec.txt index 6e9c999fa..3893a7e00 100644 --- a/extras/rpc-spec.txt +++ b/extras/rpc-spec.txt @@ -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 diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c index 8e38dd23d..27d243853 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.c @@ -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'; diff --git a/libtransmission/rpcimpl.c b/libtransmission/rpcimpl.c index 2ccfa4020..b3a4efdaf 100644 --- a/libtransmission/rpcimpl.c +++ b/libtransmission/rpcimpl.c @@ -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 ); diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index 777560fbd..4f8f54186 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -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;