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.
This commit is contained in:
Juliusz Chroboczek 2011-01-16 15:47:09 +00:00
parent 6fdb8dabea
commit 96141bdbff
3 changed files with 6 additions and 13 deletions

View File

@ -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 )

View File

@ -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 );

View File

@ -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 )
{