mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-16 15:12:30 +00:00
* Moved Timer to rak/timer.h.
* Added position affinity to ChunkSelector, still needs more work to make it move forward without needing to finish all pieces. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@604 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -41,9 +41,9 @@
|
||||
#include <stdexcept>
|
||||
#include <torrent/bencode.h>
|
||||
|
||||
#include "utils/task.h"
|
||||
#include "curl_get.h"
|
||||
#include "http_queue.h"
|
||||
#include "globals.h"
|
||||
#include "manager.h"
|
||||
|
||||
#include "download_factory.h"
|
||||
@@ -60,16 +60,16 @@ DownloadFactory::DownloadFactory(const std::string& uri, Manager* m) :
|
||||
m_session(false),
|
||||
m_start(false) {
|
||||
|
||||
m_taskLoad.set_iterator(utils::taskScheduler.end());
|
||||
m_taskLoad.set_iterator(taskScheduler.end());
|
||||
m_taskLoad.set_slot(sigc::mem_fun(*this, &DownloadFactory::receive_load));
|
||||
|
||||
m_taskCommit.set_iterator(utils::taskScheduler.end());
|
||||
m_taskCommit.set_iterator(taskScheduler.end());
|
||||
m_taskCommit.set_slot(sigc::mem_fun(*this, &DownloadFactory::receive_commit));
|
||||
}
|
||||
|
||||
DownloadFactory::~DownloadFactory() {
|
||||
utils::taskScheduler.erase(&m_taskLoad);
|
||||
utils::taskScheduler.erase(&m_taskCommit);
|
||||
taskScheduler.erase(&m_taskLoad);
|
||||
taskScheduler.erase(&m_taskCommit);
|
||||
|
||||
delete m_stream;
|
||||
m_stream = NULL;
|
||||
@@ -77,12 +77,12 @@ DownloadFactory::~DownloadFactory() {
|
||||
|
||||
void
|
||||
DownloadFactory::load() {
|
||||
utils::taskScheduler.insert(&m_taskLoad, utils::Timer::cache());
|
||||
taskScheduler.insert(&m_taskLoad, cachedTime);
|
||||
}
|
||||
|
||||
void
|
||||
DownloadFactory::commit() {
|
||||
utils::taskScheduler.insert(&m_taskCommit, utils::Timer::cache());
|
||||
taskScheduler.insert(&m_taskCommit, cachedTime);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+5
-4
@@ -37,15 +37,16 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <rak/functional.h>
|
||||
|
||||
#include "globals.h"
|
||||
#include "log.h"
|
||||
#include "rak/functional.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
void
|
||||
Log::push_front(const std::string& msg) {
|
||||
Base::push_front(Type(utils::Timer::cache(), msg));
|
||||
Base::push_front(Type(cachedTime, msg));
|
||||
|
||||
if (size() > 50)
|
||||
Base::pop_back();
|
||||
@@ -54,8 +55,8 @@ Log::push_front(const std::string& msg) {
|
||||
}
|
||||
|
||||
Log::iterator
|
||||
Log::find_older(utils::Timer t) {
|
||||
return std::find_if(begin(), end(), rak::on(rak::mem_ptr_ref(&Type::first), std::bind2nd(std::less_equal<utils::Timer>(), t)));
|
||||
Log::find_older(rak::timer t) {
|
||||
return std::find_if(begin(), end(), rak::on(rak::mem_ptr_ref(&Type::first), std::bind2nd(std::less_equal<rak::timer>(), t)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-4
@@ -41,13 +41,13 @@
|
||||
#include <string>
|
||||
#include <sigc++/signal.h>
|
||||
|
||||
#include "utils/timer.h"
|
||||
#include <rak/timer.h>
|
||||
|
||||
namespace core {
|
||||
|
||||
class Log : private std::deque<std::pair<utils::Timer, std::string> > {
|
||||
class Log : private std::deque<std::pair<rak::timer, std::string> > {
|
||||
public:
|
||||
typedef std::pair<utils::Timer, std::string> Type;
|
||||
typedef std::pair<rak::timer, std::string> Type;
|
||||
typedef std::deque<Type> Base;
|
||||
typedef sigc::signal0<void> Signal;
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
|
||||
void push_front(const std::string& msg);
|
||||
|
||||
iterator find_older(utils::Timer t);
|
||||
iterator find_older(rak::timer t);
|
||||
|
||||
Signal& signal_update() { return m_signalUpdate; }
|
||||
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
#define RTORRENT_CORE_POLL_MANAGER_H
|
||||
|
||||
#include <sys/select.h>
|
||||
#include <rak/timer.h>
|
||||
#include <sigc++/signal.h>
|
||||
#include <torrent/poll.h>
|
||||
|
||||
#include "curl_stack.h"
|
||||
#include "utils/timer.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
CurlStack* get_http_stack() { return &m_httpStack; }
|
||||
torrent::Poll* get_torrent_poll() { return m_poll; }
|
||||
|
||||
virtual void poll(utils::Timer timeout) = 0;
|
||||
virtual void poll(rak::timer timeout) = 0;
|
||||
|
||||
// Use a signal, connect checking for input and updating the display.
|
||||
Signal& signal_interrupted() { return m_signalInterrupted; }
|
||||
|
||||
@@ -61,11 +61,11 @@ PollManagerEPoll::~PollManagerEPoll() {
|
||||
}
|
||||
|
||||
void
|
||||
PollManagerEPoll::poll(utils::Timer timeout) {
|
||||
PollManagerEPoll::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, utils::Timer(torrent::next_timeout()));
|
||||
timeout = std::min(timeout, rak::timer(torrent::next_timeout()));
|
||||
|
||||
if (m_httpStack.is_busy()) {
|
||||
// When we're using libcurl we need to use select, but as this is
|
||||
@@ -99,7 +99,7 @@ PollManagerEPoll::poll(utils::Timer timeout) {
|
||||
}
|
||||
|
||||
// Clear the timeout since we've already used it in the select call.
|
||||
timeout = utils::Timer();
|
||||
timeout = rak::timer();
|
||||
}
|
||||
|
||||
// Yes, below is how much code really *should* have been in this
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
|
||||
torrent::Poll* get_torrent_poll();
|
||||
|
||||
void poll(utils::Timer timeout);
|
||||
void poll(rak::timer timeout);
|
||||
|
||||
private:
|
||||
PollManagerEPoll(torrent::Poll* p) : PollManager(p) {}
|
||||
|
||||
@@ -61,9 +61,9 @@ PollManagerSelect::~PollManagerSelect() {
|
||||
}
|
||||
|
||||
void
|
||||
PollManagerSelect::poll(utils::Timer timeout) {
|
||||
PollManagerSelect::poll(rak::timer timeout) {
|
||||
torrent::perform();
|
||||
timeout = std::min(timeout, utils::Timer(torrent::next_timeout()));
|
||||
timeout = std::min(timeout, rak::timer(torrent::next_timeout()));
|
||||
|
||||
#if defined USE_VARIABLE_FDSET
|
||||
std::memset(m_readSet, 0, m_setSize);
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
static PollManagerSelect* create(int maxOpenSockets);
|
||||
~PollManagerSelect();
|
||||
|
||||
void poll(utils::Timer timeout);
|
||||
void poll(rak::timer timeout);
|
||||
|
||||
private:
|
||||
PollManagerSelect(torrent::Poll* p) : PollManager(p) {}
|
||||
|
||||
Reference in New Issue
Block a user