From 96141bdbff898cee5e07c7aa4e388e3542d6e20e Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Sun, 16 Jan 2011 15:47:09 +0000 Subject: [PATCH] Consolidate both versions of tr_isPex into a single function. There used to be two versions of tr_isPex; one correct in peer-mgr.c, and one buggy in resume.c. The buggy version caused us to reject all peers with non-trivial flags when resuming. --- libtransmission/peer-mgr.c | 6 ------ libtransmission/peer-mgr.h | 6 ++++++ libtransmission/resume.c | 7 ------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c index b54772bdf..1a9d7f3b3 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.c @@ -1766,12 +1766,6 @@ tr_peerMgrAddIncoming( tr_peerMgr * manager, managerUnlock( manager ); } -static tr_bool -tr_isPex( const tr_pex * pex ) -{ - return pex && tr_isAddress( &pex->addr ); -} - void tr_peerMgrAddPex( tr_torrent * tor, uint8_t from, const tr_pex * pex, int8_t seedProbability ) diff --git a/libtransmission/peer-mgr.h b/libtransmission/peer-mgr.h index 9c9026bb7..ed64623d9 100644 --- a/libtransmission/peer-mgr.h +++ b/libtransmission/peer-mgr.h @@ -131,6 +131,12 @@ typedef struct tr_peer } tr_peer; +static inline tr_bool +tr_isPex( const tr_pex * pex ) +{ + return pex && tr_isAddress( &pex->addr ); +} + const tr_address * tr_peerAddress( const tr_peer * ); int tr_pexCompare( const void * a, const void * b ); diff --git a/libtransmission/resume.c b/libtransmission/resume.c index f285f02fd..ca9b6e4af 100644 --- a/libtransmission/resume.c +++ b/libtransmission/resume.c @@ -103,13 +103,6 @@ savePeers( tr_benc * dict, const tr_torrent * tor ) tr_free( pex ); } -static tr_bool -tr_isPex( const tr_pex * pex ) -{ - return tr_isAddress( &pex->addr ) - && ( pex->flags & 3 ) == pex->flags; -} - static int addPeers( tr_torrent * tor, const uint8_t * buf, int buflen ) {