From ef6e709ef69044dc2bea24f2d486bcabfa3f58af Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 25 Sep 2009 14:35:28 +0000 Subject: [PATCH] added wait_for_alert to python binding --- ChangeLog | 1 + bindings/python/src/session.cpp | 6 ++++++ docs/manual.rst | 2 ++ 3 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index e5a75c11b..fe1a6f225 100644 --- a/ChangeLog +++ b/ChangeLog @@ -76,6 +76,7 @@ release 0.14.7 * fixed deadlock in natpmp * resume data alerts are always posted, regardless of alert mask + * added wait_for_alert to python binding release 0.14.6 diff --git a/bindings/python/src/session.cpp b/bindings/python/src/session.cpp index 2d2d220ee..5e4f85296 100644 --- a/bindings/python/src/session.cpp +++ b/bindings/python/src/session.cpp @@ -129,6 +129,11 @@ namespace return; } + alert const* wait_for_alert(session& s, int ms) + { + return s.wait_for_alert(milliseconds(ms)); + } + list get_torrents(session& s) { list ret; @@ -318,6 +323,7 @@ void bind_session() #endif .def("set_alert_mask", allow_threads(&session::set_alert_mask)) .def("pop_alert", allow_threads(&session::pop_alert)) + .def("wait_for_alert", &wait_for_alert, return_internal_reference<>()) .def("add_extension", &add_extension) .def("set_peer_proxy", allow_threads(&session::set_peer_proxy)) .def("set_tracker_proxy", allow_threads(&session::set_tracker_proxy)) diff --git a/docs/manual.rst b/docs/manual.rst index d6459a96a..db8166d69 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -930,6 +930,8 @@ same pointer until the alert is popped by calling ``pop_alert``. This is useful leaving any alert dispatching mechanism independent of this blocking call, the dispatcher can be called and it can pop the alert independently. +In the python binding, ``wait_for_alert`` takes the number of milliseconds to wait as an integer. + ``set_alert_queue_size_limit()`` you can specify how many alerts can be awaiting for dispatching. If this limit is reached, new incoming alerts can not be received until alerts are popped by calling ``pop_alert``. Default value is 1000.