diff options
Diffstat (limited to 'trackerlogic.c')
-rw-r--r-- | trackerlogic.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/trackerlogic.c b/trackerlogic.c index 8308205..184edae 100644 --- a/trackerlogic.c +++ b/trackerlogic.c | |||
@@ -22,8 +22,9 @@ | |||
22 | /* GLOBAL VARIABLES */ | 22 | /* GLOBAL VARIABLES */ |
23 | static ot_vector all_torrents[256]; | 23 | static ot_vector all_torrents[256]; |
24 | static ot_vector changeset; | 24 | static ot_vector changeset; |
25 | #ifdef WANT_BLACKLISTING | 25 | #if defined ( WANT_BLACKLISTING ) || defined( WANT_CLOSED_TRACKER ) |
26 | static ot_vector blacklist; | 26 | static ot_vector accesslist; |
27 | #define WANT_ACCESS_CONTROL | ||
27 | #endif | 28 | #endif |
28 | 29 | ||
29 | size_t changeset_size = 0; | 30 | size_t changeset_size = 0; |
@@ -159,9 +160,14 @@ ot_torrent *add_peer_to_torrent( ot_hash *hash, ot_peer *peer, int from_changese | |||
159 | ot_vector *torrents_list = &all_torrents[*hash[0]], *peer_pool; | 160 | ot_vector *torrents_list = &all_torrents[*hash[0]], *peer_pool; |
160 | int base_pool = 0; | 161 | int base_pool = 0; |
161 | 162 | ||
162 | #ifdef WANT_BLACKLISTING | 163 | #ifdef WANT_ACCESS_CONTROL |
163 | binary_search( hash, blacklist.data, blacklist.size, OT_HASH_COMPARE_SIZE, OT_HASH_COMPARE_SIZE, &exactmatch ); | 164 | binary_search( hash, accesslist.data, accesslist.size, OT_HASH_COMPARE_SIZE, OT_HASH_COMPARE_SIZE, &exactmatch ); |
164 | if( exactmatch ) | 165 | |
166 | #ifdef WANT_CLOSED_TRACKER | ||
167 | exactmatch = !exactmatch; | ||
168 | #endif | ||
169 | |||
170 | if( !exactmatch ) | ||
165 | return NULL; | 171 | return NULL; |
166 | #endif | 172 | #endif |
167 | 173 | ||
@@ -736,15 +742,15 @@ void deinit_logic( void ) { | |||
736 | changeset_size = 0; | 742 | changeset_size = 0; |
737 | } | 743 | } |
738 | 744 | ||
739 | #ifdef WANT_BLACKLISTING | 745 | #ifdef WANT_ACCESS_CONTROL |
740 | void blacklist_reset( void ) { | 746 | void accesslist_reset( void ) { |
741 | free( blacklist.data ); | 747 | free( accesslist.data ); |
742 | byte_zero( &blacklist, sizeof( blacklist ) ); | 748 | byte_zero( &accesslist, sizeof( accesslist ) ); |
743 | } | 749 | } |
744 | 750 | ||
745 | int blacklist_addentry( ot_hash *infohash ) { | 751 | int accesslist_addentry( ot_hash *infohash ) { |
746 | int em; | 752 | int em; |
747 | void *insert = vector_find_or_insert( &blacklist, infohash, OT_HASH_COMPARE_SIZE, OT_HASH_COMPARE_SIZE, &em ); | 753 | void *insert = vector_find_or_insert( &accesslist, infohash, OT_HASH_COMPARE_SIZE, OT_HASH_COMPARE_SIZE, &em ); |
748 | 754 | ||
749 | if( !insert ) | 755 | if( !insert ) |
750 | return -1; | 756 | return -1; |