From d7b3024dbc33f68105ff4cfc38838e620b046364 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 20 Nov 2008 20:39:19 +0000 Subject: [PATCH] (libT) #1488: peer port missing in json rpc interface --- doc/rpc-spec.txt | 1 + libtransmission/peer-mgr.c | 2 +- libtransmission/rpcimpl.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/rpc-spec.txt b/doc/rpc-spec.txt index 864393549..d45514a23 100644 --- a/doc/rpc-spec.txt +++ b/doc/rpc-spec.txt @@ -204,6 +204,7 @@ | isUploadingTo | 'boolean' | tr_peer_stat | peerIsChoked | 'boolean' | tr_peer_stat | peerIsInterested | 'boolean' | tr_peer_stat + | port | number | tr_peer_stat | progress | 'double' | tr_peer_stat | rateToClient (B/s) | number | tr_peer_stat | rateToPeer (B/s) | number | tr_peer_stat diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c index 86c70b2bd..07a831320 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.c @@ -1840,7 +1840,7 @@ tr_peerMgrPeerStats( const tr_peerMgr * manager, tr_netNtop( &peer->in_addr, stat->addr, sizeof( stat->addr ) ); tr_strlcpy( stat->client, ( peer->client ? peer->client : "" ), sizeof( stat->client ) ); - stat->port = peer->port; + stat->port = ntohs( peer->port ); stat->from = atom->from; stat->progress = peer->progress; stat->isEncrypted = tr_peerIoIsEncrypted( peer->io ) ? 1 : 0; diff --git a/libtransmission/rpcimpl.c b/libtransmission/rpcimpl.c index 28a1039c6..05f783c16 100644 --- a/libtransmission/rpcimpl.c +++ b/libtransmission/rpcimpl.c @@ -250,6 +250,7 @@ addPeers( const tr_torrent * tor, tr_bencDictAddInt( d, "isUploadingTo", peer->isUploadingTo ); tr_bencDictAddInt( d, "peerIsChoked", peer->peerIsChoked ); tr_bencDictAddInt( d, "peerIsInterested", peer->peerIsInterested ); + tr_bencDictAddInt( d, "port", peer->port ); tr_bencDictAddDouble( d, "progress", peer->progress ); tr_bencDictAddInt( d, "rateToClient", (int)( peer->rateToClient * 1024.0 ) );