summaryrefslogtreecommitdiff
path: root/trackerlogic.h
diff options
context:
space:
mode:
Diffstat (limited to 'trackerlogic.h')
-rw-r--r--trackerlogic.h16
1 files changed, 4 insertions, 12 deletions
diff --git a/trackerlogic.h b/trackerlogic.h
index 67b14e1..86737ab 100644
--- a/trackerlogic.h
+++ b/trackerlogic.h
@@ -46,14 +46,6 @@ typedef struct {
46#define OT_ADMINIP_MAX 64 46#define OT_ADMINIP_MAX 64
47#define OT_MAX_THREADS 16 47#define OT_MAX_THREADS 16
48 48
49/* We maintain a list of 4096 pointers to sorted list of ot_torrent structs
50 Sort key is, of course, its hash */
51#define OT_BUCKET_COUNT 1024
52static inline ot_vector *hash_to_bucket( ot_vector *vectors, ot_hash *hash ) {
53 unsigned char *local_hash = hash[0];
54 return vectors + ( ( local_hash[0] << 2 ) | ( local_hash[1] >> 6 ) );
55}
56
57/* This list points to 9 pools of peers each grouped in five-minute-intervals 49/* This list points to 9 pools of peers each grouped in five-minute-intervals
58 thus achieving a timeout of 2700s or 45 minutes 50 thus achieving a timeout of 2700s or 45 minutes
59 These pools are sorted by its binary content */ 51 These pools are sorted by its binary content */
@@ -105,14 +97,14 @@ typedef struct {
105#define WANT_TRACKER_SYNC_PARAM( param ) 97#define WANT_TRACKER_SYNC_PARAM( param )
106#endif 98#endif
107 99
108int init_logic( const char * const serverdir ); 100int trackerlogic_init( const char * const serverdir );
109void deinit_logic( void ); 101void trackerlogic_deinit( void );
110 102
111enum { STATS_MRTG, STATS_TOP5, STATS_DMEM, STATS_TCP, STATS_UDP, STATS_SLASH24S, STATS_SLASH24S_OLD, SYNC_IN, SYNC_OUT, STATS_FULLSCRAPE }; 103enum { STATS_CONNS, STATS_PEERS, STATS_TOP5, STATS_DMEM, STATS_TCP, STATS_UDP, STATS_SLASH24S, SYNC_IN, SYNC_OUT, STATS_FULLSCRAPE };
112 104
113ot_torrent *add_peer_to_torrent( ot_hash *hash, ot_peer *peer WANT_TRACKER_SYNC_PARAM( int from_changeset ) ); 105ot_torrent *add_peer_to_torrent( ot_hash *hash, ot_peer *peer WANT_TRACKER_SYNC_PARAM( int from_changeset ) );
114size_t remove_peer_from_torrent( ot_hash *hash, ot_peer *peer, char *reply, int is_tcp ); 106size_t remove_peer_from_torrent( ot_hash *hash, ot_peer *peer, char *reply, int is_tcp );
115size_t return_peers_for_torrent( ot_torrent *torrent, size_t amount, char *reply, int is_tcp ); 107size_t return_peers_for_torrent( ot_hash *hash, size_t amount, char *reply, int is_tcp );
116size_t return_fullscrape_for_tracker( char **reply ); 108size_t return_fullscrape_for_tracker( char **reply );
117size_t return_tcp_scrape_for_torrent( ot_hash *hash, int amount, char *reply ); 109size_t return_tcp_scrape_for_torrent( ot_hash *hash, int amount, char *reply );
118size_t return_udp_scrape_for_torrent( ot_hash *hash, char *reply ); 110size_t return_udp_scrape_for_torrent( ot_hash *hash, char *reply );