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:
parent
976dc9e4c3
commit
e17b795634
1 changed files with 11 additions and 2 deletions
|
@ -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 )
|
||||
|
|
Loading…
Reference in a new issue