]> git.ipfire.org Git - thirdparty/opentracker.git/commitdiff
Tidy up v6 handler
authorDirk Engling <erdgeist@erdgeist.org>
Sun, 31 Mar 2024 22:48:09 +0000 (00:48 +0200)
committerDirk Engling <erdgeist@erdgeist.org>
Sun, 31 Mar 2024 22:48:09 +0000 (00:48 +0200)
trackerlogic.h

index f235de8dd624bc82cd23596bf5c4154cb3ba6f11..47d6a31817169c8e0e0f121cb5f9f32bb5f72e8a 100644 (file)
@@ -27,9 +27,12 @@ typedef struct { ot_ip6 address; int bits; }
 #ifdef WANT_V6
 #define OT_IP_SIZE 16
 #define PEERS_BENCODED "6:peers6"
+/* List of peers should fit in a single UDP packet (around 1200 bytes) */
+#define OT_MAX_PEERS_UDP 66
 #else
 #define OT_IP_SIZE 4
 #define PEERS_BENCODED "5:peers"
+#define OT_MAX_PEERS_UDP 200
 #endif
 
 /* Some tracker behaviour tunable */
@@ -44,13 +47,6 @@ typedef struct { ot_ip6 address; int bits; }
 
 #define OT_CLIENT_REQUEST_INTERVAL_RANDOM ( OT_CLIENT_REQUEST_INTERVAL - OT_CLIENT_REQUEST_VARIATION/2 + (int)( nrand48(ws->rand48_state) % OT_CLIENT_REQUEST_VARIATION ) )
 
-/* List of peers should fit in a single UDP packet (around 1200 bytes) */
-#ifdef WANT_V6
-#define OT_MAX_PEERS_UDP 66
-#else
-#define OT_MAX_PEERS_UDP 200
-#endif
-
 /* If WANT_MODEST_FULLSCRAPES is on, ip addresses may not
    fullscrape more frequently than this amount in seconds */
 #define OT_MODEST_PEER_TIMEOUT (60*5)
@@ -79,9 +75,7 @@ extern volatile int g_opentracker_running;
 extern uint32_t g_tracker_id;
 typedef enum { FLAG_TCP, FLAG_UDP, FLAG_MCA, FLAG_SELFPIPE } PROTO_FLAG;
 
-typedef struct {
-  uint8_t data[OT_IP_SIZE+2+2];
-} ot_peer;
+typedef uint8_t ot_peer[OT_IP_SIZE+2+2];
 static const uint8_t PEER_FLAG_SEEDING   = 0x80;
 static const uint8_t PEER_FLAG_COMPLETED = 0x40;
 static const uint8_t PEER_FLAG_STOPPED   = 0x20;