diff --git a/ChangeLog b/ChangeLog index ff5704e7a..ef1bf408b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ * fix uTP edge case where udp socket buffer fills up * fix nagle implementation in uTP + * expose post_torrent_updates and state_update_alert to python bindings * fix incorrect SSL error messages * fix windows build of shared library with openssl * fix race condition causing shutdown hang diff --git a/bindings/python/src/alert.cpp b/bindings/python/src/alert.cpp index 1e12db551..f5621dfe7 100644 --- a/bindings/python/src/alert.cpp +++ b/bindings/python/src/alert.cpp @@ -51,6 +51,18 @@ list stats_alert_transferred(stats_alert const& alert) return result; } +list get_status_from_update_alert(state_update_alert const& alert) +{ + list result; + + for (std::vector::const_iterator i = alert.status.begin(); i != alert.status.end(); ++i) + { + result.append(*i); + } + return result; +} + + void bind_alert() { using boost::noncopyable; @@ -341,6 +353,11 @@ void bind_alert() .def_readonly("prev_state", &state_changed_alert::prev_state) ; + class_, noncopyable>( + "state_update_alert", no_init) + .add_property("status", &get_status_from_update_alert) + ; + class_, noncopyable>( "dht_reply_alert", no_init) .def_readonly("num_peers", &dht_reply_alert::num_peers) diff --git a/bindings/python/src/session.cpp b/bindings/python/src/session.cpp index d47721d5b..7c9b08bc7 100644 --- a/bindings/python/src/session.cpp +++ b/bindings/python/src/session.cpp @@ -513,6 +513,7 @@ void bind_session() arg("fingerprint")=fingerprint("LT",0,1,0,0) , arg("flags")=session::start_default_features | session::add_default_plugins)) ) + .def("post_torrent_updates", allow_threads(&session::post_torrent_updates)) .def( "listen_on", &listen_on , (arg("min"), "max", arg("interface") = (char const*)0, arg("flags") = 0) diff --git a/bindings/python/src/torrent_status.cpp b/bindings/python/src/torrent_status.cpp index 6f08ba97b..5346b26a6 100644 --- a/bindings/python/src/torrent_status.cpp +++ b/bindings/python/src/torrent_status.cpp @@ -24,6 +24,7 @@ object verified_pieces(torrent_status const& s) { return bitfield_to_list(s.veri void bind_torrent_status() { scope status = class_("torrent_status") + .def_readonly("info_hash", &torrent_status::info_hash) .def_readonly("state", &torrent_status::state) .def_readonly("paused", &torrent_status::paused) .def_readonly("auto_managed", &torrent_status::auto_managed)