From 4ce77639404e04500705025a139a8d94b3cf5d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=A8=B1?= <1265578519@qq.com> Date: Tue, 14 May 2024 22:05:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9udp=E8=AF=B7=E6=B1=82=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E8=BF=94=E5=9B=9E400=EF=BC=8C=E5=B7=B2=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E5=8F=91v0.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 对udp请求正确返回400,已重新发v0.3 --- opentracker/ot_udp.c | 2 +- opentracker/trackerlogic.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opentracker/ot_udp.c b/opentracker/ot_udp.c index 97ccd38..54c1534 100644 --- a/opentracker/ot_udp.c +++ b/opentracker/ot_udp.c @@ -178,7 +178,7 @@ int handle_udp6(int64 serversocket, struct ot_workstruct *ws) { uint32_t numwant = ntohl(inpacket[92 / 4]); size_t max_peers = ip6_isv4mapped(remoteip) ? OT_MAX_PEERS_UDP4 : OT_MAX_PEERS_UDP6; if (numwant > max_peers) - numwant = max_peers; + numwant = 400; ws->reply = ws->outbuf + 8; ws->reply_size = 8 + add_peer_to_torrent_and_return_peers(FLAG_UDP, ws, numwant); diff --git a/opentracker/trackerlogic.h b/opentracker/trackerlogic.h index 94870e9..8a5c121 100644 --- a/opentracker/trackerlogic.h +++ b/opentracker/trackerlogic.h @@ -27,8 +27,8 @@ typedef struct { int bits; } ot_net; /* List of peers should fit in a single UDP packet (around 1200 bytes) */ -#define OT_MAX_PEERS_UDP6 400 -#define OT_MAX_PEERS_UDP4 400 +#define OT_MAX_PEERS_UDP6 0 +#define OT_MAX_PEERS_UDP4 0 #define OT_IP_SIZE6 16 #define OT_IP_SIZE4 4