mirror of
git://erdgeist.org/opentracker
synced 2025-02-17 06:31:30 +08:00
Some premature optimization lead to always only 8bytes of ot_peers being copied
This commit is contained in:
parent
02b3abbab6
commit
4ced0484ab
@ -33,7 +33,7 @@ static ssize_t clean_single_bucket( ot_peer *peers, size_t peer_count, time_t ti
|
|||||||
while( peers < last_peer )
|
while( peers < last_peer )
|
||||||
if( ( timediff = timedout + OT_PEERTIME( peers ) ) < OT_PEER_TIMEOUT ) {
|
if( ( timediff = timedout + OT_PEERTIME( peers ) ) < OT_PEER_TIMEOUT ) {
|
||||||
OT_PEERTIME( peers ) = timediff;
|
OT_PEERTIME( peers ) = timediff;
|
||||||
*(uint64_t*)(insert_point++) = *(uint64_t*)(peers++);
|
memcpy( insert_point++, peers++, sizeof(ot_peer));
|
||||||
} else
|
} else
|
||||||
if( OT_PEERFLAG( peers++ ) & PEER_FLAG_SEEDING )
|
if( OT_PEERFLAG( peers++ ) & PEER_FLAG_SEEDING )
|
||||||
(*removed_seeders)++;
|
(*removed_seeders)++;
|
||||||
|
@ -244,7 +244,7 @@ void vector_redistribute_buckets( ot_peerlist * peer_list ) {
|
|||||||
bucket_dest->space *= OT_VECTOR_GROW_RATIO;
|
bucket_dest->space *= OT_VECTOR_GROW_RATIO;
|
||||||
}
|
}
|
||||||
peers_new = (ot_peer*)bucket_dest->data;
|
peers_new = (ot_peer*)bucket_dest->data;
|
||||||
*(uint64_t*)(peers_new + bucket_dest->size++) = *(uint64_t*)(peers_old++);
|
memcpy(peers_new + bucket_dest->size++, peers_old++, sizeof(ot_peer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user