diff --git a/libtransmission/fastresume.c b/libtransmission/fastresume.c index 4a6cddd05..407d7af24 100644 --- a/libtransmission/fastresume.c +++ b/libtransmission/fastresume.c @@ -548,11 +548,16 @@ parsePeers( tr_torrent * tor, const uint8_t * buf, uint32_t len ) if( !tor->info.isPrivate ) { + int i; const int count = len / sizeof(tr_pex); - tr_peerMgrAddPex( tor->handle->peerMgr, - tor->info.hash, - TR_PEER_FROM_CACHE, - (tr_pex*)buf, count ); + + for( i=0; ihandle->peerMgr, tor->info.hash, TR_PEER_FROM_CACHE, &pex ); + } + tr_dbg( "found %i peers in resume file", count ); ret = TR_FR_PEERS; } diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c index 95ab1f501..f7af3da7a 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.c @@ -1075,17 +1075,13 @@ void tr_peerMgrAddPex( tr_peerMgr * manager, const uint8_t * torrentHash, uint8_t from, - const tr_pex * pex, - int pexCount ) + const tr_pex * pex ) { Torrent * t; - const tr_pex * end; - managerLock( manager ); t = getExistingTorrent( manager, torrentHash ); - for( end=pex+pexCount; pex!=end; ++pex ) - ensureAtomExists( t, &pex->in_addr, pex->port, pex->flags, from ); + ensureAtomExists( t, &pex->in_addr, pex->port, pex->flags, from ); managerUnlock( manager ); } diff --git a/libtransmission/peer-mgr.h b/libtransmission/peer-mgr.h index 97973c063..b48d5515e 100644 --- a/libtransmission/peer-mgr.h +++ b/libtransmission/peer-mgr.h @@ -50,8 +50,7 @@ void tr_peerMgrAddPeers( tr_peerMgr * manager, void tr_peerMgrAddPex( tr_peerMgr * manager, const uint8_t * torrentHash, uint8_t from, - const tr_pex * pex, - int pexCount ); + const tr_pex * pex ); void tr_peerMgrSetBlame( tr_peerMgr * manager, const uint8_t * torrentHash,