White space

dynamic-accesslists
Dirk Engling 3 years ago
parent 00bd3b2009
commit 0695b48870

@ -51,19 +51,19 @@ void add_torrent_from_saved_state( ot_hash hash, ot_time base, size_t down_count
if( !accesslist_hashisvalid( hash ) ) if( !accesslist_hashisvalid( hash ) )
return mutex_bucket_unlock_by_hash( hash, 0 ); return mutex_bucket_unlock_by_hash( hash, 0 );
torrent = vector_find_or_insert( torrents_list, (void*)hash, sizeof( ot_torrent ), OT_HASH_COMPARE_SIZE, &exactmatch ); torrent = vector_find_or_insert( torrents_list, (void*)hash, sizeof( ot_torrent ), OT_HASH_COMPARE_SIZE, &exactmatch );
if( !torrent || exactmatch ) if( !torrent || exactmatch )
return mutex_bucket_unlock_by_hash( hash, 0 ); return mutex_bucket_unlock_by_hash( hash, 0 );
/* Create a new torrent entry, then */ /* Create a new torrent entry, then */
memcpy( torrent->hash, hash, sizeof(ot_hash) ); memcpy( torrent->hash, hash, sizeof(ot_hash) );
if( !( torrent->peer_list = malloc( sizeof (ot_peerlist) ) ) ) { if( !( torrent->peer_list = malloc( sizeof (ot_peerlist) ) ) ) {
vector_remove_torrent( torrents_list, torrent ); vector_remove_torrent( torrents_list, torrent );
return mutex_bucket_unlock_by_hash( hash, 0 ); return mutex_bucket_unlock_by_hash( hash, 0 );
} }
byte_zero( torrent->peer_list, sizeof( ot_peerlist ) ); byte_zero( torrent->peer_list, sizeof( ot_peerlist ) );
torrent->peer_list->base = base; torrent->peer_list->base = base;
torrent->peer_list->down_count = down_count; torrent->peer_list->down_count = down_count;
@ -200,7 +200,7 @@ static size_t return_peers_all( ot_peerlist *peer_list, char *reply ) {
while( peer_count-- ) { while( peer_count-- ) {
if( OT_PEERFLAG(peers) & PEER_FLAG_SEEDING ) { if( OT_PEERFLAG(peers) & PEER_FLAG_SEEDING ) {
r_end-=OT_PEER_COMPARE_SIZE; r_end-=OT_PEER_COMPARE_SIZE;
memcpy(r_end,peers++,OT_PEER_COMPARE_SIZE); memcpy(r_end,peers++,OT_PEER_COMPARE_SIZE);
} else { } else {
memcpy(reply,peers++,OT_PEER_COMPARE_SIZE); memcpy(reply,peers++,OT_PEER_COMPARE_SIZE);
reply+=OT_PEER_COMPARE_SIZE; reply+=OT_PEER_COMPARE_SIZE;
@ -218,7 +218,7 @@ static size_t return_peers_selection( ot_peerlist *peer_list, size_t amount, cha
unsigned int shift = 0; unsigned int shift = 0;
size_t result = OT_PEER_COMPARE_SIZE * amount; size_t result = OT_PEER_COMPARE_SIZE * amount;
char * r_end = reply + result; char * r_end = reply + result;
if( OT_PEERLIST_HASBUCKETS(peer_list) ) { if( OT_PEERLIST_HASBUCKETS(peer_list) ) {
num_buckets = bucket_list->size; num_buckets = bucket_list->size;
bucket_list = (ot_vector *)bucket_list->data; 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
peer = ((ot_peer*)bucket_list[bucket_index].data) + bucket_offset; peer = ((ot_peer*)bucket_list[bucket_index].data) + bucket_offset;
if( OT_PEERFLAG(peer) & PEER_FLAG_SEEDING ) { if( OT_PEERFLAG(peer) & PEER_FLAG_SEEDING ) {
r_end-=OT_PEER_COMPARE_SIZE; r_end-=OT_PEER_COMPARE_SIZE;
memcpy(r_end,peer,OT_PEER_COMPARE_SIZE); memcpy(r_end,peer,OT_PEER_COMPARE_SIZE);
} else { } else {
memcpy(reply,peer,OT_PEER_COMPARE_SIZE); memcpy(reply,peer,OT_PEER_COMPARE_SIZE);
reply+=OT_PEER_COMPARE_SIZE; reply+=OT_PEER_COMPARE_SIZE;

Loading…
Cancel
Save