diff options
Diffstat (limited to 'src/ot_udp.c')
| -rw-r--r-- | src/ot_udp.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/ot_udp.c b/src/ot_udp.c index 2918c25..7a05b61 100644 --- a/src/ot_udp.c +++ b/src/ot_udp.c | |||
| @@ -204,11 +204,9 @@ int handle_udp6(int64_t serversocket, struct ot_workstruct *ws) { | |||
| 204 | if (!left) | 204 | if (!left) |
| 205 | OT_PEERFLAG(ws->peer) |= PEER_FLAG_SEEDING; | 205 | OT_PEERFLAG(ws->peer) |= PEER_FLAG_SEEDING; |
| 206 | 206 | ||
| 207 | reply = udp_reply_header(ws->outbuf, UDP_ACTION_ANNOUNCE, request); | 207 | ws->reply = udp_reply_header(ws->outbuf, UDP_ACTION_ANNOUNCE, request); |
| 208 | 208 | ||
| 209 | if (OT_PEERFLAG(ws->peer) & PEER_FLAG_STOPPED) { /* Peer is gone. */ | 209 | if (OT_PEERFLAG(ws->peer) & PEER_FLAG_STOPPED) { /* Peer is gone. */ |
| 210 | /* This one writes the whole reply, and leaves the header alone */ | ||
| 211 | ws->reply = ws->outbuf; | ||
| 212 | ws->reply_size = remove_peer_from_torrent(FLAG_UDP, ws); | 210 | ws->reply_size = remove_peer_from_torrent(FLAG_UDP, ws); |
| 213 | } else { | 211 | } else { |
| 214 | /* List of peers should fit in a single UDP packet */ | 212 | /* List of peers should fit in a single UDP packet */ |
| @@ -216,7 +214,6 @@ int handle_udp6(int64_t serversocket, struct ot_workstruct *ws) { | |||
| 216 | if (numwant > max_peers) | 214 | if (numwant > max_peers) |
| 217 | numwant = max_peers; | 215 | numwant = max_peers; |
| 218 | 216 | ||
| 219 | ws->reply = reply; | ||
| 220 | ws->reply_size = add_peer_to_torrent_and_return_peers(FLAG_UDP, ws, numwant); | 217 | ws->reply_size = add_peer_to_torrent_and_return_peers(FLAG_UDP, ws, numwant); |
| 221 | 218 | ||
| 222 | /* The announce path answers a refusal itself, so nothing is left here | 219 | /* The announce path answers a refusal itself, so nothing is left here |
| @@ -225,8 +222,8 @@ int handle_udp6(int64_t serversocket, struct ot_workstruct *ws) { | |||
| 225 | udp_send_error(serversocket, ws, "Tracker is out of resources, try again later.", remoteip, remoteport); | 222 | udp_send_error(serversocket, ws, "Tracker is out of resources, try again later.", remoteip, remoteport); |
| 226 | return 1; | 223 | return 1; |
| 227 | } | 224 | } |
| 228 | ws->reply_size += UDP_REPLY_HEADER_SIZE; | ||
| 229 | } | 225 | } |
| 226 | ws->reply_size += UDP_REPLY_HEADER_SIZE; | ||
| 230 | 227 | ||
| 231 | socket_send(serversocket, ws->outbuf, ws->reply_size, remoteip, remoteport); | 228 | socket_send(serversocket, ws->outbuf, ws->reply_size, remoteip, remoteport); |
| 232 | stats_issue_event(ws, EVENT_ANNOUNCE, FLAG_UDP, ws->reply_size); | 229 | stats_issue_event(ws, EVENT_ANNOUNCE, FLAG_UDP, ws->reply_size); |
