summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <>2009-01-15 22:10:54 +0000
committererdgeist <>2009-01-15 22:10:54 +0000
commit4ced0484abae55546e04954b3dafad46f9db348a (patch)
tree945111cb3d8712fd6c26d281dca535b3863d78a8
parent02b3abbab639625afdd02f0f0a9965fdf49f4996 (diff)
Some premature optimization lead to always only 8bytes of ot_peers being copied
-rw-r--r--ot_clean.c2
-rw-r--r--ot_vector.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/ot_clean.c b/ot_clean.c
index 11c85ab..6ce1941 100644
--- a/ot_clean.c
+++ b/ot_clean.c
@@ -33,7 +33,7 @@ static ssize_t clean_single_bucket( ot_peer *peers, size_t peer_count, time_t ti
33 while( peers < last_peer ) 33 while( peers < last_peer )
34 if( ( timediff = timedout + OT_PEERTIME( peers ) ) < OT_PEER_TIMEOUT ) { 34 if( ( timediff = timedout + OT_PEERTIME( peers ) ) < OT_PEER_TIMEOUT ) {
35 OT_PEERTIME( peers ) = timediff; 35 OT_PEERTIME( peers ) = timediff;
36 *(uint64_t*)(insert_point++) = *(uint64_t*)(peers++); 36 memcpy( insert_point++, peers++, sizeof(ot_peer));
37 } else 37 } else
38 if( OT_PEERFLAG( peers++ ) & PEER_FLAG_SEEDING ) 38 if( OT_PEERFLAG( peers++ ) & PEER_FLAG_SEEDING )
39 (*removed_seeders)++; 39 (*removed_seeders)++;
diff --git a/ot_vector.c b/ot_vector.c
index f7481f1..a69d9a5 100644
--- a/ot_vector.c
+++ b/ot_vector.c
@@ -244,7 +244,7 @@ void vector_redistribute_buckets( ot_peerlist * peer_list ) {
244 bucket_dest->space *= OT_VECTOR_GROW_RATIO; 244 bucket_dest->space *= OT_VECTOR_GROW_RATIO;
245 } 245 }
246 peers_new = (ot_peer*)bucket_dest->data; 246 peers_new = (ot_peer*)bucket_dest->data;
247 *(uint64_t*)(peers_new + bucket_dest->size++) = *(uint64_t*)(peers_old++); 247 memcpy(peers_new + bucket_dest->size++, peers_old++, sizeof(ot_peer));
248 } 248 }
249 } 249 }
250 250