1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-03 13:03:50 +00:00

lock torrent before accessing peers

This commit is contained in:
Mitchell Livingston 2006-08-13 16:19:19 +00:00
parent 976dc9e4c3
commit e17b795634

View file

@ -407,9 +407,18 @@ int tr_getFinished( tr_torrent_t * tor )
tr_peer_t * tr_getPeer( tr_torrent_t * tor, int peerNum)
{
tr_peer_t * peer;
tr_lockLock( &tor->lock );
if (peerNum < 0 || peerNum >= tor->peerCount)
return NULL;
return tor->peers[peerNum];
peer = NULL;
else
peer = tor->peers[peerNum];
tr_lockUnlock( &tor->lock );
return peer;
}
tr_stat_t * tr_torrentStat( tr_torrent_t * tor )