mirror of
git://erdgeist.org/opentracker
synced 2025-04-03 03:47:16 +08:00
account downloaded before early returns
This commit is contained in:
parent
65675cd4da
commit
c094695add
@ -195,6 +195,9 @@ ot_torrent *add_peer_to_torrent( ot_hash *hash, ot_peer *peer ) {
|
|||||||
peer_pool = &torrent->peer_list->peers[0];
|
peer_pool = &torrent->peer_list->peers[0];
|
||||||
peer_dest = vector_find_or_insert( peer_pool, (void*)peer, sizeof( ot_peer ), OT_PEER_COMPARE_SIZE, &exactmatch );
|
peer_dest = vector_find_or_insert( peer_pool, (void*)peer, sizeof( ot_peer ), OT_PEER_COMPARE_SIZE, &exactmatch );
|
||||||
|
|
||||||
|
if( OT_FLAG(peer) & PEER_FLAG_COMPLETED )
|
||||||
|
torrent->peer_list->downloaded++;
|
||||||
|
|
||||||
/* If we hadn't had a match in current pool, create peer there and
|
/* If we hadn't had a match in current pool, create peer there and
|
||||||
remove it from all older pools */
|
remove it from all older pools */
|
||||||
if( !exactmatch ) {
|
if( !exactmatch ) {
|
||||||
@ -215,8 +218,6 @@ ot_torrent *add_peer_to_torrent( ot_hash *hash, ot_peer *peer ) {
|
|||||||
if( !(OT_FLAG(peer_dest) & PEER_FLAG_SEEDING ) && (OT_FLAG(peer) & PEER_FLAG_SEEDING ) )
|
if( !(OT_FLAG(peer_dest) & PEER_FLAG_SEEDING ) && (OT_FLAG(peer) & PEER_FLAG_SEEDING ) )
|
||||||
torrent->peer_list->seed_count[0]++;
|
torrent->peer_list->seed_count[0]++;
|
||||||
}
|
}
|
||||||
if( OT_FLAG(peer) & PEER_FLAG_COMPLETED )
|
|
||||||
torrent->peer_list->downloaded++;
|
|
||||||
|
|
||||||
return torrent;
|
return torrent;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user