mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-21 00:26:16 +00:00
* Added byte alignment check, if required use a different means of
reading ints from ProtocolBuffer. * Don't round the task for ThrottleScheduler to the nearest second since it has a sub-second timeout. Change the other timeouts to first add cached and timespan, then round to the nearest seconds. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@529 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -118,3 +118,25 @@ AC_DEFUN([TORRENT_CHECK_EXECINFO], [
|
|||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([TORRENT_CHECK_ALIGN], [
|
||||||
|
AC_MSG_CHECKING(byte alignment)
|
||||||
|
|
||||||
|
AC_RUN_IFELSE(
|
||||||
|
[[#include <inttypes.h>
|
||||||
|
int main() {
|
||||||
|
char buf[5] = { 0, 0, 0, 0, 1 };
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < 4; ++i)
|
||||||
|
if (*(uint32_t*)(buf + 1) == 0) return -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
]],
|
||||||
|
[
|
||||||
|
AC_MSG_RESULT(none)
|
||||||
|
], [
|
||||||
|
AC_DEFINE(USE_ALIGN, 1, Require byte alignment)
|
||||||
|
AC_MSG_RESULT(required)
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ WindowDownloadList::~WindowDownloadList() {
|
|||||||
|
|
||||||
void
|
void
|
||||||
WindowDownloadList::redraw() {
|
WindowDownloadList::redraw() {
|
||||||
utils::displayScheduler.insert(&m_taskUpdate, utils::Timer::cache().round_seconds() + 1000000);
|
utils::displayScheduler.insert(&m_taskUpdate, (utils::Timer::cache() + 1000000).round_seconds());
|
||||||
|
|
||||||
m_canvas->erase();
|
m_canvas->erase();
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ WindowDownloadStatusbar::WindowDownloadStatusbar(core::Download* d) :
|
|||||||
|
|
||||||
void
|
void
|
||||||
WindowDownloadStatusbar::redraw() {
|
WindowDownloadStatusbar::redraw() {
|
||||||
utils::displayScheduler.insert(&m_taskUpdate, utils::Timer::cache().round_seconds() + 1000000);
|
utils::displayScheduler.insert(&m_taskUpdate, (utils::Timer::cache() + 1000000).round_seconds());
|
||||||
|
|
||||||
m_canvas->erase();
|
m_canvas->erase();
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ WindowFileList::WindowFileList(core::Download* d, unsigned int* focus) :
|
|||||||
|
|
||||||
void
|
void
|
||||||
WindowFileList::redraw() {
|
WindowFileList::redraw() {
|
||||||
utils::displayScheduler.insert(&m_taskUpdate, utils::Timer::cache().round_seconds() + 10 * 1000000);
|
utils::displayScheduler.insert(&m_taskUpdate, (utils::Timer::cache() + 10 * 1000000).round_seconds());
|
||||||
m_canvas->erase();
|
m_canvas->erase();
|
||||||
|
|
||||||
if (m_download->get_download().get_entry_size() == 0 ||
|
if (m_download->get_download().get_entry_size() == 0 ||
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ WindowHttpQueue::WindowHttpQueue(core::HttpQueue* q) :
|
|||||||
|
|
||||||
void
|
void
|
||||||
WindowHttpQueue::redraw() {
|
WindowHttpQueue::redraw() {
|
||||||
utils::displayScheduler.insert(&m_taskUpdate, utils::Timer::cache().round_seconds() + 1000000);
|
utils::displayScheduler.insert(&m_taskUpdate, (utils::Timer::cache() + 1000000).round_seconds());
|
||||||
|
|
||||||
cleanup_list();
|
cleanup_list();
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ WindowPeerInfo::WindowPeerInfo(core::Download* d, PList* l, PList::iterator* f)
|
|||||||
|
|
||||||
void
|
void
|
||||||
WindowPeerInfo::redraw() {
|
WindowPeerInfo::redraw() {
|
||||||
utils::displayScheduler.insert(&m_taskUpdate, utils::Timer::cache().round_seconds() + 1000000);
|
utils::displayScheduler.insert(&m_taskUpdate, (utils::Timer::cache() + 1000000).round_seconds());
|
||||||
m_canvas->erase();
|
m_canvas->erase();
|
||||||
|
|
||||||
int y = 0;
|
int y = 0;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ WindowPeerList::WindowPeerList(core::Download* d, PList* l, PList::iterator* f)
|
|||||||
|
|
||||||
void
|
void
|
||||||
WindowPeerList::redraw() {
|
WindowPeerList::redraw() {
|
||||||
utils::displayScheduler.insert(&m_taskUpdate, utils::Timer::cache().round_seconds() + 1000000);
|
utils::displayScheduler.insert(&m_taskUpdate, (utils::Timer::cache() + 1000000).round_seconds());
|
||||||
m_canvas->erase();
|
m_canvas->erase();
|
||||||
|
|
||||||
int x = 2;
|
int x = 2;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ WindowStatusbar::WindowStatusbar(core::Manager* c) :
|
|||||||
|
|
||||||
void
|
void
|
||||||
WindowStatusbar::redraw() {
|
WindowStatusbar::redraw() {
|
||||||
utils::displayScheduler.insert(&m_taskUpdate, utils::Timer::cache().round_seconds() + 1000000);
|
utils::displayScheduler.insert(&m_taskUpdate, (utils::Timer::cache() + 1000000).round_seconds());
|
||||||
|
|
||||||
m_canvas->erase();
|
m_canvas->erase();
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ WindowTitle::WindowTitle(const std::string& s) :
|
|||||||
|
|
||||||
void
|
void
|
||||||
WindowTitle::redraw() {
|
WindowTitle::redraw() {
|
||||||
utils::displayScheduler.insert(&m_taskUpdate, utils::Timer::cache().round_seconds() + 1000000);
|
utils::displayScheduler.insert(&m_taskUpdate, (utils::Timer::cache() + 1000000).round_seconds());
|
||||||
m_canvas->erase();
|
m_canvas->erase();
|
||||||
|
|
||||||
m_canvas->print(std::max(0, (m_canvas->get_width() - (int)m_title.size()) / 2 - 4), 0,
|
m_canvas->print(std::max(0, (m_canvas->get_width() - (int)m_title.size()) / 2 - 4), 0,
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ WindowTrackerList::WindowTrackerList(core::Download* d, unsigned int* focus) :
|
|||||||
void
|
void
|
||||||
WindowTrackerList::redraw() {
|
WindowTrackerList::redraw() {
|
||||||
// TODO: Make this depend on tracker signal.
|
// TODO: Make this depend on tracker signal.
|
||||||
utils::displayScheduler.insert(&m_taskUpdate, utils::Timer::cache().round_seconds() + 10 * 1000000);
|
utils::displayScheduler.insert(&m_taskUpdate, (utils::Timer::cache() + 10 * 1000000).round_seconds());
|
||||||
m_canvas->erase();
|
m_canvas->erase();
|
||||||
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|||||||
+3
-1
@@ -225,13 +225,15 @@ main(int argc, char** argv) {
|
|||||||
while (!uiControl.is_shutdown_completed()) {
|
while (!uiControl.is_shutdown_completed()) {
|
||||||
utils::Timer::update();
|
utils::Timer::update();
|
||||||
utils::taskScheduler.execute(utils::Timer::cache());
|
utils::taskScheduler.execute(utils::Timer::cache());
|
||||||
|
|
||||||
// This needs to be called every second or so. Currently done by
|
// This needs to be called every second or so. Currently done by
|
||||||
// the throttle task in libtorrent.
|
// the throttle task in libtorrent.
|
||||||
if (!utils::displayScheduler.empty() &&
|
if (!utils::displayScheduler.empty() &&
|
||||||
utils::displayScheduler.get_next_timeout() <= utils::Timer::cache())
|
utils::displayScheduler.get_next_timeout() <= utils::Timer::cache())
|
||||||
uiControl.get_display().do_update();
|
uiControl.get_display().do_update();
|
||||||
|
|
||||||
|
//utils::Timer::update();
|
||||||
|
|
||||||
// Do shutdown check before poll, not after.
|
// Do shutdown check before poll, not after.
|
||||||
uiControl.get_core().get_poll_manager()->poll(!utils::taskScheduler.empty() ?
|
uiControl.get_core().get_poll_manager()->poll(!utils::taskScheduler.empty() ?
|
||||||
utils::taskScheduler.get_next_timeout() - utils::Timer::cache() :
|
utils::taskScheduler.get_next_timeout() - utils::Timer::cache() :
|
||||||
|
|||||||
Reference in New Issue
Block a user