diff options
author | Dirk Engling <erdgeist@erdgeist.org> | 2024-04-01 00:48:09 +0200 |
---|---|---|
committer | Dirk Engling <erdgeist@erdgeist.org> | 2024-04-01 00:48:09 +0200 |
commit | 73e839f5ff0bdedc513f7668dc882d5f57208dca (patch) | |
tree | 060d8b5335db67b4c2ace99cfe11615ef52cdf75 | |
parent | aca3ee0ac8cc6b389bcae2b767c0289ba21c8bf0 (diff) |
Tidy up v6 handler
-rw-r--r-- | trackerlogic.h | 14 |
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; | |||
79 | extern uint32_t g_tracker_id; | 75 | extern uint32_t g_tracker_id; |
80 | typedef enum { FLAG_TCP, FLAG_UDP, FLAG_MCA, FLAG_SELFPIPE } PROTO_FLAG; | 76 | typedef enum { FLAG_TCP, FLAG_UDP, FLAG_MCA, FLAG_SELFPIPE } PROTO_FLAG; |
81 | 77 | ||
82 | typedef struct { | 78 | typedef uint8_t ot_peer[OT_IP_SIZE+2+2]; |
83 | uint8_t data[OT_IP_SIZE+2+2]; | ||
84 | } ot_peer; | ||
85 | static const uint8_t PEER_FLAG_SEEDING = 0x80; | 79 | static const uint8_t PEER_FLAG_SEEDING = 0x80; |
86 | static const uint8_t PEER_FLAG_COMPLETED = 0x40; | 80 | static const uint8_t PEER_FLAG_COMPLETED = 0x40; |
87 | static const uint8_t PEER_FLAG_STOPPED = 0x20; | 81 | static const uint8_t PEER_FLAG_STOPPED = 0x20; |