]> granicus.if.org Git - transmission/commitdiff
(trunk libT) add a bool to tr_peer_stat and the RPC peer list to denote whether or...
authorJordan Lee <jordan@transmissionbt.com>
Fri, 18 Feb 2011 04:07:43 +0000 (04:07 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Fri, 18 Feb 2011 04:07:43 +0000 (04:07 +0000)
extras/rpc-spec.txt
libtransmission/peer-mgr.c
libtransmission/rpcimpl.c
libtransmission/transmission.h

index 6e9c999fa5ad4e0ca18361b16c07e7d4a575bb35..3893a7e007461ab1bf68c377b0a6624b8ea7bca0 100644 (file)
                       | 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
    ------+---------+-----------+----------------+-------------------------------
    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
index 8e38dd23deaa10087a0c45d3c5545e9b7330be4f..27d24385321b307cc27c89f2e3a60b7445a73dd9 100644 (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';
index 2ccfa4020e2ff632048d5c4462f51daacae1c9e0..b3a4efdafc6e8c626f7aad3f53f8a049b4664f40 100644 (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 );
index 777560fbd13fd682e290e3cfccfeb648aaa48050..4f8f54186134b4357e83ffbe0a23b80e8c33cbe2 100644 (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;