This commit is contained in:
Charles Kerr 2007-10-01 00:08:12 +00:00
parent 7cc6771318
commit 6bef7def52
2 changed files with 7 additions and 3 deletions

View File

@ -1084,11 +1084,13 @@ tr_peerMgrGetPeers( tr_peerMgr * manager,
{
const Torrent * t = getExistingTorrent( (tr_peerMgr*)manager, torrentHash );
int i, peerCount;
const int isLocked = torrentIsLocked( t );
const tr_peer ** peers = (const tr_peer **) tr_ptrArrayPeek( t->peers, &peerCount );
tr_pex * pex = tr_new( tr_pex, peerCount );
tr_pex * walk = pex;
managerLock( manager );
if( !isLocked )
torrentLock( (Torrent*)t );
t = getExistingTorrent( (tr_peerMgr*)manager, torrentHash );
peers = (const tr_peer **) tr_ptrArrayPeek( t->peers, &peerCount );
@ -1111,7 +1113,9 @@ tr_peerMgrGetPeers( tr_peerMgr * manager,
qsort( pex, peerCount, sizeof(tr_pex), tr_pexCompare );
*setme_pex = pex;
managerUnlock( manager );
if( !isLocked )
torrentUnlock( (Torrent*)t );
return peerCount;
}

View File

@ -68,7 +68,7 @@ enum
KEEPALIVE_INTERVAL_SECS = 90, /* idle seconds before we send a keepalive */
PEX_INTERVAL = (60 * 1000), /* msec between calls to sendPex() */
PEER_PULSE_INTERVAL = (100), /* msec between calls to pulse() */
PEER_PULSE_INTERVAL = (50) , /* msec between calls to pulse() */
};
enum