fix bug in udp tracker announce messages
This commit is contained in:
parent
533699bbb5
commit
a5284b583c
|
@ -709,9 +709,9 @@ namespace libtorrent
|
|||
aux::write_int32(action_t::announce, out); // action (announce)
|
||||
aux::write_int32(m_transaction_id, out); // transaction_id
|
||||
std::copy(req.info_hash.begin(), req.info_hash.end(), out.data()); // info_hash
|
||||
out.subspan(20);
|
||||
out = out.subspan(20);
|
||||
std::copy(req.pid.begin(), req.pid.end(), out.data()); // peer_id
|
||||
out.subspan(20);
|
||||
out = out.subspan(20);
|
||||
aux::write_int64(req.downloaded, out); // downloaded
|
||||
aux::write_int64(req.left, out); // left
|
||||
aux::write_int64(req.uploaded, out); // uploaded
|
||||
|
|
|
@ -94,6 +94,12 @@ struct udp_tracker
|
|||
{
|
||||
case 0: // connect
|
||||
|
||||
if (bytes_transferred < 16)
|
||||
{
|
||||
std::printf("invalid connect message: %d Bytes, expected 16 Bytes\n"
|
||||
, int(bytes_transferred));
|
||||
return;
|
||||
}
|
||||
std::printf("%s: UDP connect from %s\n", time_now_string()
|
||||
, print_endpoint(*from).c_str());
|
||||
ptr = buffer;
|
||||
|
@ -109,6 +115,13 @@ struct udp_tracker
|
|||
|
||||
case 1: // announce
|
||||
|
||||
if (bytes_transferred < 84)
|
||||
{
|
||||
std::printf("invalid announce message: %d Bytes, expected 84 Bytes\n"
|
||||
, int(bytes_transferred));
|
||||
return;
|
||||
}
|
||||
|
||||
++m_udp_announces;
|
||||
std::printf("%s: UDP announce [%d]\n", time_now_string()
|
||||
, int(m_udp_announces));
|
||||
|
|
Loading…
Reference in New Issue