summaryrefslogtreecommitdiff
path: root/trackerlogic.h
diff options
context:
space:
mode:
Diffstat (limited to 'trackerlogic.h')
-rw-r--r--trackerlogic.h14
1 files changed, 4 insertions, 10 deletions
diff --git a/trackerlogic.h b/trackerlogic.h
index f235de8..47d6a31 100644
--- a/trackerlogic.h
+++ b/trackerlogic.h
@@ -27,9 +27,12 @@ typedef struct { ot_ip6 address; int bits; }
27#ifdef WANT_V6 27#ifdef WANT_V6
28#define OT_IP_SIZE 16 28#define OT_IP_SIZE 16
29#define PEERS_BENCODED "6:peers6" 29#define PEERS_BENCODED "6:peers6"
30/* List of peers should fit in a single UDP packet (around 1200 bytes) */
31#define OT_MAX_PEERS_UDP 66
30#else 32#else
31#define OT_IP_SIZE 4 33#define OT_IP_SIZE 4
32#define PEERS_BENCODED "5:peers" 34#define PEERS_BENCODED "5:peers"
35#define OT_MAX_PEERS_UDP 200
33#endif 36#endif
34 37
35/* Some tracker behaviour tunable */ 38/* Some tracker behaviour tunable */
@@ -44,13 +47,6 @@ typedef struct { ot_ip6 address; int bits; }
44 47
45#define OT_CLIENT_REQUEST_INTERVAL_RANDOM ( OT_CLIENT_REQUEST_INTERVAL - OT_CLIENT_REQUEST_VARIATION/2 + (int)( nrand48(ws->rand48_state) % OT_CLIENT_REQUEST_VARIATION ) ) 48#define OT_CLIENT_REQUEST_INTERVAL_RANDOM ( OT_CLIENT_REQUEST_INTERVAL - OT_CLIENT_REQUEST_VARIATION/2 + (int)( nrand48(ws->rand48_state) % OT_CLIENT_REQUEST_VARIATION ) )
46 49
47/* List of peers should fit in a single UDP packet (around 1200 bytes) */
48#ifdef WANT_V6
49#define OT_MAX_PEERS_UDP 66
50#else
51#define OT_MAX_PEERS_UDP 200
52#endif
53
54/* If WANT_MODEST_FULLSCRAPES is on, ip addresses may not 50/* If WANT_MODEST_FULLSCRAPES is on, ip addresses may not
55 fullscrape more frequently than this amount in seconds */ 51 fullscrape more frequently than this amount in seconds */
56#define OT_MODEST_PEER_TIMEOUT (60*5) 52#define OT_MODEST_PEER_TIMEOUT (60*5)
@@ -79,9 +75,7 @@ extern volatile int g_opentracker_running;
79extern uint32_t g_tracker_id; 75extern uint32_t g_tracker_id;
80typedef enum { FLAG_TCP, FLAG_UDP, FLAG_MCA, FLAG_SELFPIPE } PROTO_FLAG; 76typedef enum { FLAG_TCP, FLAG_UDP, FLAG_MCA, FLAG_SELFPIPE } PROTO_FLAG;
81 77
82typedef struct { 78typedef uint8_t ot_peer[OT_IP_SIZE+2+2];
83 uint8_t data[OT_IP_SIZE+2+2];
84} ot_peer;
85static const uint8_t PEER_FLAG_SEEDING = 0x80; 79static const uint8_t PEER_FLAG_SEEDING = 0x80;
86static const uint8_t PEER_FLAG_COMPLETED = 0x40; 80static const uint8_t PEER_FLAG_COMPLETED = 0x40;
87static const uint8_t PEER_FLAG_STOPPED = 0x20; 81static const uint8_t PEER_FLAG_STOPPED = 0x20;