merged RC_1_1 into master
This commit is contained in:
commit
8a85e1c01a
|
@ -82,6 +82,7 @@
|
||||||
* resume data no longer has timestamps of files
|
* resume data no longer has timestamps of files
|
||||||
* require C++11 to build libtorrent
|
* require C++11 to build libtorrent
|
||||||
|
|
||||||
|
* expose post_dht_stats() to python binding
|
||||||
* fix backwards compatibility to downloads without partfiles
|
* fix backwards compatibility to downloads without partfiles
|
||||||
* improve part-file related error messages
|
* improve part-file related error messages
|
||||||
* fix reporting &redundant= in tracker announces
|
* fix reporting &redundant= in tracker announces
|
||||||
|
|
|
@ -922,6 +922,7 @@ void bind_session()
|
||||||
.def("outgoing_ports", &outgoing_ports)
|
.def("outgoing_ports", &outgoing_ports)
|
||||||
#endif
|
#endif
|
||||||
.def("post_torrent_updates", allow_threads(<::session::post_torrent_updates), arg("flags") = 0xffffffff)
|
.def("post_torrent_updates", allow_threads(<::session::post_torrent_updates), arg("flags") = 0xffffffff)
|
||||||
|
.def("post_dht_stats", allow_threads(<::session::post_dht_stats))
|
||||||
.def("post_session_stats", allow_threads(<::session::post_session_stats))
|
.def("post_session_stats", allow_threads(<::session::post_session_stats))
|
||||||
.def("is_listening", allow_threads(<::session::is_listening))
|
.def("is_listening", allow_threads(<::session::is_listening))
|
||||||
.def("listen_port", allow_threads(<::session::listen_port))
|
.def("listen_port", allow_threads(<::session::listen_port))
|
||||||
|
|
|
@ -520,6 +520,22 @@ class test_session(unittest.TestCase):
|
||||||
self.assertTrue(isinstance(a.values, dict))
|
self.assertTrue(isinstance(a.values, dict))
|
||||||
self.assertTrue(len(a.values) > 0)
|
self.assertTrue(len(a.values) > 0)
|
||||||
|
|
||||||
|
def test_post_dht_stats(self):
|
||||||
|
s = lt.session({'alert_mask': lt.alert.category_t.stats_notification, 'enable_dht': False})
|
||||||
|
s.post_dht_stats()
|
||||||
|
alerts = []
|
||||||
|
# first the stats headers log line. but not if logging is disabled
|
||||||
|
time.sleep(1)
|
||||||
|
alerts = s.pop_alerts()
|
||||||
|
a = alerts.pop(0)
|
||||||
|
while not isinstance(a, lt.dht_stats_alert):
|
||||||
|
a = alerts.pop(0
|
||||||
|
)
|
||||||
|
self.assertTrue(isinstance(a, lt.dht_stats_alert))
|
||||||
|
self.assertTrue(isinstance(a.active_requests, list))
|
||||||
|
self.assertTrue(isinstance(a.routing_table, list))
|
||||||
|
|
||||||
|
|
||||||
def test_unknown_settings(self):
|
def test_unknown_settings(self):
|
||||||
try:
|
try:
|
||||||
s = lt.session({'unexpected-key-name': 42})
|
s = lt.session({'unexpected-key-name': 42})
|
||||||
|
|
|
@ -242,6 +242,8 @@ struct utp_socket_impl
|
||||||
, m_stalled(false)
|
, m_stalled(false)
|
||||||
, m_confirmed(false)
|
, m_confirmed(false)
|
||||||
{
|
{
|
||||||
|
TORRENT_ASSERT((m_recv_id == ((m_send_id + 1) & 0xffff))
|
||||||
|
|| (m_send_id == ((m_recv_id + 1) & 0xffff)));
|
||||||
m_sm.inc_stats_counter(counters::num_utp_idle);
|
m_sm.inc_stats_counter(counters::num_utp_idle);
|
||||||
TORRENT_ASSERT(m_userdata);
|
TORRENT_ASSERT(m_userdata);
|
||||||
m_delay_sample_hist.fill(std::numeric_limits<std::uint32_t>::max());
|
m_delay_sample_hist.fill(std::numeric_limits<std::uint32_t>::max());
|
||||||
|
@ -2605,9 +2607,16 @@ bool utp_socket_impl::incoming_packet(span<std::uint8_t const> buf
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
|
||||||
auto const* ph = reinterpret_cast<utp_header const*>(buf.data());
|
auto const* ph = reinterpret_cast<utp_header const*>(buf.data());
|
||||||
|
|
||||||
m_sm.inc_stats_counter(counters::utp_packets_in);
|
m_sm.inc_stats_counter(counters::utp_packets_in);
|
||||||
|
|
||||||
|
if (buf.size() < sizeof(utp_header))
|
||||||
|
{
|
||||||
|
UTP_LOG("%8p: ERROR: incoming packet size too small:%d (ignored)\n"
|
||||||
|
, static_cast<void*>(this), int(buf.size()));
|
||||||
|
m_sm.inc_stats_counter(counters::utp_invalid_pkts_in);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (ph->get_version() != 1)
|
if (ph->get_version() != 1)
|
||||||
{
|
{
|
||||||
UTP_LOG("%8p: ERROR: incoming packet version:%d (ignored)\n"
|
UTP_LOG("%8p: ERROR: incoming packet version:%d (ignored)\n"
|
||||||
|
@ -3001,7 +3010,14 @@ bool utp_socket_impl::incoming_packet(span<std::uint8_t const> buf
|
||||||
UTP_LOGV("%8p: received ST_SYN state:%s seq_nr:%d ack_nr:%d\n"
|
UTP_LOGV("%8p: received ST_SYN state:%s seq_nr:%d ack_nr:%d\n"
|
||||||
, static_cast<void*>(this), socket_state_names[m_state], m_seq_nr, m_ack_nr);
|
, static_cast<void*>(this), socket_state_names[m_state], m_seq_nr, m_ack_nr);
|
||||||
#endif
|
#endif
|
||||||
TORRENT_ASSERT(m_send_id == ph->connection_id);
|
if (m_send_id != ph->connection_id)
|
||||||
|
{
|
||||||
|
#if TORRENT_UTP_LOG
|
||||||
|
UTP_LOGV("%8p: received invalid connection_id:%d expected: %d\n"
|
||||||
|
, static_cast<void*>(this), int(ph->connection_id), int(m_send_id));
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
TORRENT_ASSERT(m_recv_id == ((m_send_id + 1) & 0xffff));
|
TORRENT_ASSERT(m_recv_id == ((m_send_id + 1) & 0xffff));
|
||||||
|
|
||||||
defer_ack();
|
defer_ack();
|
||||||
|
|
Loading…
Reference in New Issue