summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--trackerlogic.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/trackerlogic.c b/trackerlogic.c
index 310466c..21bd790 100644
--- a/trackerlogic.c
+++ b/trackerlogic.c
@@ -51,19 +51,19 @@ void add_torrent_from_saved_state( ot_hash hash, ot_time base, size_t down_count
51 51
52 if( !accesslist_hashisvalid( hash ) ) 52 if( !accesslist_hashisvalid( hash ) )
53 return mutex_bucket_unlock_by_hash( hash, 0 ); 53 return mutex_bucket_unlock_by_hash( hash, 0 );
54 54
55 torrent = vector_find_or_insert( torrents_list, (void*)hash, sizeof( ot_torrent ), OT_HASH_COMPARE_SIZE, &exactmatch ); 55 torrent = vector_find_or_insert( torrents_list, (void*)hash, sizeof( ot_torrent ), OT_HASH_COMPARE_SIZE, &exactmatch );
56 if( !torrent || exactmatch ) 56 if( !torrent || exactmatch )
57 return mutex_bucket_unlock_by_hash( hash, 0 ); 57 return mutex_bucket_unlock_by_hash( hash, 0 );
58 58
59 /* Create a new torrent entry, then */ 59 /* Create a new torrent entry, then */
60 memcpy( torrent->hash, hash, sizeof(ot_hash) ); 60 memcpy( torrent->hash, hash, sizeof(ot_hash) );
61 61
62 if( !( torrent->peer_list = malloc( sizeof (ot_peerlist) ) ) ) { 62 if( !( torrent->peer_list = malloc( sizeof (ot_peerlist) ) ) ) {
63 vector_remove_torrent( torrents_list, torrent ); 63 vector_remove_torrent( torrents_list, torrent );
64 return mutex_bucket_unlock_by_hash( hash, 0 ); 64 return mutex_bucket_unlock_by_hash( hash, 0 );
65 } 65 }
66 66
67 byte_zero( torrent->peer_list, sizeof( ot_peerlist ) ); 67 byte_zero( torrent->peer_list, sizeof( ot_peerlist ) );
68 torrent->peer_list->base = base; 68 torrent->peer_list->base = base;
69 torrent->peer_list->down_count = down_count; 69 torrent->peer_list->down_count = down_count;
@@ -200,7 +200,7 @@ static size_t return_peers_all( ot_peerlist *peer_list, char *reply ) {
200 while( peer_count-- ) { 200 while( peer_count-- ) {
201 if( OT_PEERFLAG(peers) & PEER_FLAG_SEEDING ) { 201 if( OT_PEERFLAG(peers) & PEER_FLAG_SEEDING ) {
202 r_end-=OT_PEER_COMPARE_SIZE; 202 r_end-=OT_PEER_COMPARE_SIZE;
203 memcpy(r_end,peers++,OT_PEER_COMPARE_SIZE); 203 memcpy(r_end,peers++,OT_PEER_COMPARE_SIZE);
204 } else { 204 } else {
205 memcpy(reply,peers++,OT_PEER_COMPARE_SIZE); 205 memcpy(reply,peers++,OT_PEER_COMPARE_SIZE);
206 reply+=OT_PEER_COMPARE_SIZE; 206 reply+=OT_PEER_COMPARE_SIZE;
@@ -218,7 +218,7 @@ static size_t return_peers_selection( ot_peerlist *peer_list, size_t amount, cha
218 unsigned int shift = 0; 218 unsigned int shift = 0;
219 size_t result = OT_PEER_COMPARE_SIZE * amount; 219 size_t result = OT_PEER_COMPARE_SIZE * amount;
220 char * r_end = reply + result; 220 char * r_end = reply + result;
221 221
222 if( OT_PEERLIST_HASBUCKETS(peer_list) ) { 222 if( OT_PEERLIST_HASBUCKETS(peer_list) ) {
223 num_buckets = bucket_list->size; 223 num_buckets = bucket_list->size;
224 bucket_list = (ot_vector *)bucket_list->data; 224 bucket_list = (ot_vector *)bucket_list->data;
@@ -249,7 +249,7 @@ static size_t return_peers_selection( ot_peerlist *peer_list, size_t amount, cha
249 peer = ((ot_peer*)bucket_list[bucket_index].data) + bucket_offset; 249 peer = ((ot_peer*)bucket_list[bucket_index].data) + bucket_offset;
250 if( OT_PEERFLAG(peer) & PEER_FLAG_SEEDING ) { 250 if( OT_PEERFLAG(peer) & PEER_FLAG_SEEDING ) {
251 r_end-=OT_PEER_COMPARE_SIZE; 251 r_end-=OT_PEER_COMPARE_SIZE;
252 memcpy(r_end,peer,OT_PEER_COMPARE_SIZE); 252 memcpy(r_end,peer,OT_PEER_COMPARE_SIZE);
253 } else { 253 } else {
254 memcpy(reply,peer,OT_PEER_COMPARE_SIZE); 254 memcpy(reply,peer,OT_PEER_COMPARE_SIZE);
255 reply+=OT_PEER_COMPARE_SIZE; 255 reply+=OT_PEER_COMPARE_SIZE;