expose new listen_on flags to python

This commit is contained in:
Arvid Norberg 2011-08-13 23:30:11 +00:00
parent 1b470e0961
commit e26d49a71c
2 changed files with 12 additions and 5 deletions

View File

@ -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_<session::save_state_flags_t>("save_state_flags_t")
@ -584,6 +586,11 @@ void bind_session()
#endif
;
enum_<session::listen_on_flags_t>("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>("feed_handle")
.def("update_feed", &feed_handle::update_feed)
.def("get_feed_status", &get_feed_status)

View File

@ -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