mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-09 11:42:33 +00:00
Moved polling code to libtorrent.
This commit is contained in:
@@ -64,36 +64,12 @@ PollManagerKQueue::~PollManagerKQueue() {
|
||||
|
||||
void
|
||||
PollManagerKQueue::poll(rak::timer timeout) {
|
||||
// Add 1ms to ensure we don't idle loop due to the lack of
|
||||
// resolution.
|
||||
torrent::perform();
|
||||
timeout = std::min(timeout, rak::timer(torrent::next_timeout())) + 1000;
|
||||
|
||||
ThreadBase::release_global_lock();
|
||||
ThreadBase::entering_main_polling();
|
||||
|
||||
int status = static_cast<torrent::PollKQueue*>(m_poll)->poll((timeout.usec() + 999) / 1000);
|
||||
|
||||
ThreadBase::leaving_main_polling();
|
||||
ThreadBase::acquire_global_lock();
|
||||
|
||||
if (status == -1)
|
||||
return check_error();
|
||||
|
||||
torrent::perform();
|
||||
static_cast<torrent::PollKQueue*>(m_poll)->perform();
|
||||
static_cast<torrent::PollKQueue*>(m_poll)->do_poll();
|
||||
}
|
||||
|
||||
void
|
||||
PollManagerKQueue::poll_simple(rak::timer timeout) {
|
||||
// Add 1ms to ensure we don't idle loop due to the lack of
|
||||
// resolution.
|
||||
timeout = std::min(timeout, rak::timer(torrent::next_timeout())) + 1000;
|
||||
|
||||
if (static_cast<torrent::PollKQueue*>(m_poll)->poll((timeout.usec() + 999) / 1000) == -1)
|
||||
return check_error();
|
||||
|
||||
static_cast<torrent::PollKQueue*>(m_poll)->perform();
|
||||
static_cast<torrent::PollKQueue*>(m_poll)->do_poll(torrent::Poll::poll_worker_thread);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user