mirror of
https://github.com/transmission/transmission
synced 2024-12-24 16:52:39 +00:00
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:
parent
6fdb8dabea
commit
96141bdbff
3 changed files with 6 additions and 13 deletions
|
@ -1766,12 +1766,6 @@ tr_peerMgrAddIncoming( tr_peerMgr * manager,
|
||||||
managerUnlock( manager );
|
managerUnlock( manager );
|
||||||
}
|
}
|
||||||
|
|
||||||
static tr_bool
|
|
||||||
tr_isPex( const tr_pex * pex )
|
|
||||||
{
|
|
||||||
return pex && tr_isAddress( &pex->addr );
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
tr_peerMgrAddPex( tr_torrent * tor, uint8_t from,
|
tr_peerMgrAddPex( tr_torrent * tor, uint8_t from,
|
||||||
const tr_pex * pex, int8_t seedProbability )
|
const tr_pex * pex, int8_t seedProbability )
|
||||||
|
|
|
@ -131,6 +131,12 @@ typedef struct tr_peer
|
||||||
}
|
}
|
||||||
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 * );
|
const tr_address * tr_peerAddress( const tr_peer * );
|
||||||
|
|
||||||
int tr_pexCompare( const void * a, const void * b );
|
int tr_pexCompare( const void * a, const void * b );
|
||||||
|
|
|
@ -103,13 +103,6 @@ savePeers( tr_benc * dict, const tr_torrent * tor )
|
||||||
tr_free( pex );
|
tr_free( pex );
|
||||||
}
|
}
|
||||||
|
|
||||||
static tr_bool
|
|
||||||
tr_isPex( const tr_pex * pex )
|
|
||||||
{
|
|
||||||
return tr_isAddress( &pex->addr )
|
|
||||||
&& ( pex->flags & 3 ) == pex->flags;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
addPeers( tr_torrent * tor, const uint8_t * buf, int buflen )
|
addPeers( tr_torrent * tor, const uint8_t * buf, int buflen )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue