From c97175a51e52e7a2cb7ade905515288a47af89c9 Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Tue, 29 Jan 2008 07:16:20 +0000 Subject: [PATCH] add add_dht_router to libtorrent bindings --- libtorrent/bindings/python/src/docstrings.cpp | 2 ++ libtorrent/bindings/python/src/session.cpp | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/libtorrent/bindings/python/src/docstrings.cpp b/libtorrent/bindings/python/src/docstrings.cpp index 0fa001f39..d6e473836 100755 --- a/libtorrent/bindings/python/src/docstrings.cpp +++ b/libtorrent/bindings/python/src/docstrings.cpp @@ -96,6 +96,8 @@ char const* session_stop_dht_doc = ""; char const* session_dht_state_doc = ""; +char const* session_add_dht_router_doc = + "add dht router"; char const* session_add_torrent_doc = "Adds a new torrent to the session. Return a `torrent_handle`.\n" diff --git a/libtorrent/bindings/python/src/session.cpp b/libtorrent/bindings/python/src/session.cpp index 481348730..91befd094 100755 --- a/libtorrent/bindings/python/src/session.cpp +++ b/libtorrent/bindings/python/src/session.cpp @@ -35,6 +35,7 @@ extern char const* session_status_m_doc; extern char const* session_start_dht_doc; extern char const* session_stop_dht_doc; extern char const* session_dht_state_doc; +extern char const* session_add_dht_router_doc; extern char const* session_add_torrent_doc; extern char const* session_remove_torrent_doc; extern char const* session_set_download_rate_limit_doc; @@ -66,6 +67,12 @@ namespace return s.listen_on(std::make_pair(min_, max_), interface); } + void add_dht_router(session& s, std::string router_, int port_) + { + allow_threading_guard guard; + return s.add_dht_router(std::make_pair(router_, port_)); + } + struct invoke_extension_factory { invoke_extension_factory(object const& callback) @@ -176,6 +183,11 @@ void bind_session() , (arg("min"), "max", arg("interface") = (char const*)0) , session_listen_on_doc ) + .def( + "add_dht_router", &add_dht_router + , (arg("router"), "port") + , session_add_dht_router_doc + ) .def("is_listening", allow_threads(&session::is_listening), session_is_listening_doc) .def("listen_port", allow_threads(&session::listen_port), session_listen_port_doc) .def("status", allow_threads(&session::status), session_status_m_doc)