added wait_for_alert to python binding

This commit is contained in:
Arvid Norberg 2009-09-25 14:35:28 +00:00
parent 7e430d5a2a
commit ef6e709ef6
3 changed files with 9 additions and 0 deletions

View File

@ -76,6 +76,7 @@ release 0.14.7
* fixed deadlock in natpmp * fixed deadlock in natpmp
* resume data alerts are always posted, regardless of alert mask * resume data alerts are always posted, regardless of alert mask
* added wait_for_alert to python binding
release 0.14.6 release 0.14.6

View File

@ -129,6 +129,11 @@ namespace
return; return;
} }
alert const* wait_for_alert(session& s, int ms)
{
return s.wait_for_alert(milliseconds(ms));
}
list get_torrents(session& s) list get_torrents(session& s)
{ {
list ret; list ret;
@ -318,6 +323,7 @@ void bind_session()
#endif #endif
.def("set_alert_mask", allow_threads(&session::set_alert_mask)) .def("set_alert_mask", allow_threads(&session::set_alert_mask))
.def("pop_alert", allow_threads(&session::pop_alert)) .def("pop_alert", allow_threads(&session::pop_alert))
.def("wait_for_alert", &wait_for_alert, return_internal_reference<>())
.def("add_extension", &add_extension) .def("add_extension", &add_extension)
.def("set_peer_proxy", allow_threads(&session::set_peer_proxy)) .def("set_peer_proxy", allow_threads(&session::set_peer_proxy))
.def("set_tracker_proxy", allow_threads(&session::set_tracker_proxy)) .def("set_tracker_proxy", allow_threads(&session::set_tracker_proxy))

View File

@ -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 leaving any alert dispatching mechanism independent of this blocking call, the dispatcher
can be called and it can pop the alert independently. 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. ``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 If this limit is reached, new incoming alerts can not be received until alerts are popped
by calling ``pop_alert``. Default value is 1000. by calling ``pop_alert``. Default value is 1000.