mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-16 23:22:31 +00:00
Added start/stop keys.
Added more extensive download status information where only tracker status used to be. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@279 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -12,6 +12,9 @@ namespace core {
|
||||
|
||||
void
|
||||
HashQueue::insert(Download* d, Slot s) {
|
||||
if (d->get_download().is_hash_checking())
|
||||
return;
|
||||
|
||||
if (std::find_if(begin(), end(), func::equal(d, std::mem_fun(&HashQueueNode::get_download))) != end())
|
||||
throw std::logic_error("core::HashQueue::insert(...) received a Download that is already queued");
|
||||
|
||||
@@ -52,6 +55,8 @@ HashQueue::receive_hash_done(Base::iterator itr) {
|
||||
Base::erase(itr);
|
||||
|
||||
s();
|
||||
|
||||
fill_queue();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+29
-5
@@ -6,11 +6,29 @@
|
||||
#include <sigc++/bind.h>
|
||||
#include <torrent/exceptions.h>
|
||||
#include <torrent/http.h>
|
||||
#include <torrent/torrent.h>
|
||||
|
||||
#include "manager.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
void
|
||||
Manager::initialize() {
|
||||
torrent::Http::set_factory(m_poll.get_http_factory());
|
||||
m_httpQueue.slot_factory(m_poll.get_http_factory());
|
||||
|
||||
CurlStack::init();
|
||||
|
||||
torrent::initialize();
|
||||
torrent::listen_open(10000, 20000);
|
||||
}
|
||||
|
||||
void
|
||||
Manager::cleanup() {
|
||||
torrent::cleanup();
|
||||
core::CurlStack::cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
Manager::insert(const std::string& uri) {
|
||||
if (std::strncmp(uri.c_str(), "http://", 7))
|
||||
@@ -24,14 +42,20 @@ Manager::start(Download* d) {
|
||||
if (d->get_download().is_active())
|
||||
return;
|
||||
|
||||
if (d->get_download().is_open()) {
|
||||
d->start();
|
||||
|
||||
} else {
|
||||
if (!d->get_download().is_open())
|
||||
d->open();
|
||||
|
||||
if (d->get_download().is_hash_checked())
|
||||
d->start();
|
||||
else
|
||||
m_hashQueue.insert(d, sigc::mem_fun(*d, &Download::start));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Manager::stop(Download* d) {
|
||||
m_hashQueue.remove(d);
|
||||
|
||||
d->stop();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "download_list.h"
|
||||
#include "hash_queue.h"
|
||||
#include "http_queue.h"
|
||||
#include "poll.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
@@ -16,9 +17,15 @@ public:
|
||||
HashQueue& get_hash_queue() { return m_hashQueue; }
|
||||
HttpQueue& get_http_queue() { return m_httpQueue; }
|
||||
|
||||
Poll& get_poll() { return m_poll; }
|
||||
|
||||
void initialize();
|
||||
void cleanup();
|
||||
|
||||
void insert(const std::string& uri);
|
||||
|
||||
void start(Download* d);
|
||||
void stop(Download* d);
|
||||
|
||||
private:
|
||||
void receive_http_done(torrent::Http* http);
|
||||
@@ -29,6 +36,7 @@ private:
|
||||
DownloadList m_downloadList;
|
||||
HashQueue m_hashQueue;
|
||||
HttpQueue m_httpQueue;
|
||||
Poll m_poll;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user