expose post_dht_stats() to python binding
This commit is contained in:
parent
0edb0f28c1
commit
137baa6c04
|
@ -1,4 +1,5 @@
|
|||
|
||||
* expose post_dht_stats() to python binding
|
||||
* fix backwards compatibility to downloads without partfiles
|
||||
* improve part-file related error messages
|
||||
* fix reporting &redundant= in tracker announces
|
||||
|
|
|
@ -900,6 +900,7 @@ void bind_session()
|
|||
.def("outgoing_ports", &outgoing_ports)
|
||||
#endif
|
||||
.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("is_listening", allow_threads(<::session::is_listening))
|
||||
.def("listen_port", allow_threads(<::session::listen_port))
|
||||
|
|
|
@ -383,6 +383,21 @@ class test_session(unittest.TestCase):
|
|||
self.assertTrue(isinstance(a.values, dict))
|
||||
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):
|
||||
try:
|
||||
s = lt.session({'unexpected-key-name': 42})
|
||||
|
|
Loading…
Reference in New Issue