summaryrefslogtreecommitdiff
path: root/src/ot_udp.c
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-11-05 18:18:45 +0100
committerDirk Engling <erdgeist@erdgeist.org>2026-11-05 18:18:45 +0100
commitc6732a03cbf0efa815e8a857af8118878c053af0 (patch)
tree6e774fd381c845f38de21f9abbfe1debe53dc56d /src/ot_udp.c
parent194fc0b2f7aa37ca25a9ea058eac699b2824e95a (diff)
Answer blacklisted torrent announces with an empty packet, that carries a re-announce timeout
Diffstat (limited to 'src/ot_udp.c')
-rw-r--r--src/ot_udp.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ot_udp.c b/src/ot_udp.c
index e67ca1f..9e8e3c4 100644
--- a/src/ot_udp.c
+++ b/src/ot_udp.c
@@ -176,11 +176,13 @@ int handle_udp6(int64_t serversocket, struct ot_workstruct *ws) {
176 ws->reply = ws->outbuf + 8; 176 ws->reply = ws->outbuf + 8;
177 ws->reply_size = add_peer_to_torrent_and_return_peers(FLAG_UDP, ws, numwant); 177 ws->reply_size = add_peer_to_torrent_and_return_peers(FLAG_UDP, ws, numwant);
178 178
179 /* The announce path answers a refusal itself, so nothing is left here
180 but a tracker that could not get the memory to track the torrent */
179 if (!ws->reply_size) { 181 if (!ws->reply_size) {
180 const char err_unauth[] = "Requested download is not authorized for use with this tracker."; 182 const char err_resources[] = "Tracker is out of resources, try again later.";
181 size_t s = sizeof(err_unauth); 183 size_t s = sizeof(err_resources);
182 outpacket[0] = htonl(3); 184 outpacket[0] = htonl(3);
183 memcpy(&outpacket[2], &err_unauth[0], s); 185 memcpy(&outpacket[2], &err_resources[0], s);
184 socket_send(serversocket, ws->outbuf, 8 + s, remoteip, remoteport); 186 socket_send(serversocket, ws->outbuf, 8 + s, remoteip, remoteport);
185 return 1; 187 return 1;
186 } 188 }