fix python binding of dht_settings

This commit is contained in:
Arvid Norberg 2019-04-07 15:16:40 +02:00 committed by Arvid Norberg
parent fe2f7b1478
commit 212ea3db27
3 changed files with 30 additions and 0 deletions

View File

@ -1,3 +1,4 @@
* fix python binding of dht_settings
* tighten up various input validation checks
* fix create_torrent python binding
* update symlinks to conform to BEP 47

View File

@ -4,6 +4,7 @@
#include "boost_python.hpp"
#include <libtorrent/session.hpp>
#include <libtorrent/kademlia/dht_settings.hpp>
using namespace boost::python;
using namespace lt;
@ -65,6 +66,7 @@ void bind_session_settings()
#endif
;
{
scope s = enum_<settings_pack::proxy_type_t>("proxy_type_t")
.value("none", settings_pack::none)
.value("socks4", settings_pack::socks4)
@ -88,6 +90,7 @@ void bind_session_settings()
.def_readwrite("proxy_hostnames", &proxy_settings::proxy_hostnames)
;
#endif
}
#ifndef TORRENT_DISABLE_DHT
class_<dht::dht_settings>("dht_settings")

View File

@ -750,6 +750,32 @@ class test_peer_info(unittest.TestCase):
print(p.write_state)
class test_dht_settings(unittest.TestCase):
def test_construct(self):
ds = lt.dht_settings()
print(ds.max_peers_reply)
print(ds.search_branching)
print(ds.max_fail_count)
print(ds.max_fail_count)
print(ds.max_torrents)
print(ds.max_dht_items)
print(ds.restrict_routing_ips)
print(ds.restrict_search_ips)
print(ds.max_torrent_search_reply)
print(ds.extended_routing_table)
print(ds.aggressive_lookups)
print(ds.privacy_lookups)
print(ds.enforce_node_id)
print(ds.ignore_dark_internet)
print(ds.block_timeout)
print(ds.block_ratelimit)
print(ds.read_only)
print(ds.item_lifetime)
if __name__ == '__main__':
print(lt.__version__)
shutil.copy(os.path.join('..', '..', 'test', 'test_torrents',