From e26d49a71cabdd74e4ef9207d4f086f0f78307b5 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sat, 13 Aug 2011 23:30:11 +0000 Subject: [PATCH] expose new listen_on flags to python --- bindings/python/src/session.cpp | 15 +++++++++++---- include/libtorrent/session.hpp | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/bindings/python/src/session.cpp b/bindings/python/src/session.cpp index 9bd4b1e6b..03e865e1e 100644 --- a/bindings/python/src/session.cpp +++ b/bindings/python/src/session.cpp @@ -16,10 +16,12 @@ using namespace libtorrent; namespace { - bool listen_on(session& s, int min_, int max_, char const* interface) + void listen_on(session& s, int min_, int max_, char const* interface, int flags) { allow_threading_guard guard; - return s.listen_on(std::make_pair(min_, max_), interface); + error_code ec; + s.listen_on(std::make_pair(min_, max_), ec, interface, flags); + if (ec) throw libtorrent_exception(ec); } void outgoing_ports(session& s, int _min, int _max) @@ -461,7 +463,7 @@ void bind_session() ) .def( "listen_on", &listen_on - , (arg("min"), "max", arg("interface") = (char const*)0) + , (arg("min"), "max", arg("interface") = (char const*)0, arg("flags") = 0) ) .def("outgoing_ports", &outgoing_ports) .def("is_listening", allow_threads(&session::is_listening)) @@ -565,7 +567,7 @@ void bind_session() .def("is_paused", allow_threads(&session::is_paused)) .def("id", allow_threads(&session::id)) .def("get_cache_status", allow_threads(&session::get_cache_status)) - .def("set_peer_id", allow_threads(&session::set_peer_id)) + .def("set_peer_id", allow_threads(&session::set_peer_id)) ; enum_("save_state_flags_t") @@ -584,6 +586,11 @@ void bind_session() #endif ; + enum_("listen_on_flags_t") + .value("listen_reuse_address", session::listen_reuse_address) + .value("listen_no_system_port", session::listen_no_system_port) + ; + class_("feed_handle") .def("update_feed", &feed_handle::update_feed) .def("get_feed_status", &get_feed_status) diff --git a/include/libtorrent/session.hpp b/include/libtorrent/session.hpp index c20a00905..6056a619a 100644 --- a/include/libtorrent/session.hpp +++ b/include/libtorrent/session.hpp @@ -313,7 +313,7 @@ namespace libtorrent // this function will return false on failure. // If it fails, it will also generate alerts describing // the error. It will return true on success. - enum + enum listen_on_flags_t { listen_reuse_address = 0x01, listen_no_system_port = 0x02