mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-06 22:29:23 +00:00
* Scheduled tasks, like hash checking, didn't get called when
downloading with curl on epoll unless sockets triggered events. * Checking whetever we're interested in a peer's pieces wasn't finished, doh. * Don't use shorter timeout for "stopped" tracker request, the client now makes sure it shuts down within 5 seconds. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@577 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+16
-15
@@ -43,6 +43,7 @@
|
||||
|
||||
#include "core/download.h"
|
||||
#include "input/bindings.h"
|
||||
#include "input/manager.h"
|
||||
#include "display/window_title.h"
|
||||
#include "display/window_download_statusbar.h"
|
||||
|
||||
@@ -62,7 +63,7 @@ Download::Download(DPtr d, Control* c) :
|
||||
m_windowTitle(new WTitle(d->get_download().get_name())),
|
||||
m_windowDownloadStatus(new WDownloadStatus(d)),
|
||||
|
||||
m_window(c->get_display().end()),
|
||||
m_window(c->display()->end()),
|
||||
|
||||
m_control(c),
|
||||
m_bindings(new input::Bindings) {
|
||||
@@ -83,7 +84,7 @@ Download::Download(DPtr d, Control* c) :
|
||||
}
|
||||
|
||||
Download::~Download() {
|
||||
if (m_window != m_control->get_display().end())
|
||||
if (m_window != m_control->display()->end())
|
||||
throw std::logic_error("ui::Download::~Download() called on an active object");
|
||||
|
||||
m_connPeerConnected.disconnect();
|
||||
@@ -99,37 +100,37 @@ Download::~Download() {
|
||||
|
||||
void
|
||||
Download::activate() {
|
||||
if (m_window != m_control->get_display().end())
|
||||
if (m_window != m_control->display()->end())
|
||||
throw std::logic_error("ui::Download::activate() called on an already activated object");
|
||||
|
||||
m_control->get_display().push_front(m_windowDownloadStatus);
|
||||
m_window = m_control->get_display().insert(m_control->get_display().begin(), NULL);
|
||||
m_control->get_display().push_front(m_windowTitle);
|
||||
m_control->display()->push_front(m_windowDownloadStatus);
|
||||
m_window = m_control->display()->insert(m_control->display()->begin(), NULL);
|
||||
m_control->display()->push_front(m_windowTitle);
|
||||
|
||||
m_control->get_input().push_front(m_bindings);
|
||||
m_control->input()->push_front(m_bindings);
|
||||
|
||||
activate_display(DISPLAY_PEER_LIST);
|
||||
}
|
||||
|
||||
void
|
||||
Download::disable() {
|
||||
if (m_window == m_control->get_display().end())
|
||||
if (m_window == m_control->display()->end())
|
||||
throw std::logic_error("ui::Download::disable() called on an already disabled object");
|
||||
|
||||
disable_display();
|
||||
|
||||
m_control->get_display().erase(m_window);
|
||||
m_control->get_display().erase(m_windowTitle);
|
||||
m_control->get_display().erase(m_windowDownloadStatus);
|
||||
m_control->display()->erase(m_window);
|
||||
m_control->display()->erase(m_windowTitle);
|
||||
m_control->display()->erase(m_windowDownloadStatus);
|
||||
|
||||
m_window = m_control->get_display().end();
|
||||
m_window = m_control->display()->end();
|
||||
|
||||
m_control->get_input().erase(m_bindings);
|
||||
m_control->input()->erase(m_bindings);
|
||||
}
|
||||
|
||||
void
|
||||
Download::activate_display(Display d) {
|
||||
if (m_window == m_control->get_display().end())
|
||||
if (m_window == m_control->display()->end())
|
||||
throw std::logic_error("ui::Download::activate_display(...) could not find previous display iterator");
|
||||
|
||||
if (d >= DISPLAY_MAX_SIZE)
|
||||
@@ -138,7 +139,7 @@ Download::activate_display(Display d) {
|
||||
m_state = d;
|
||||
m_uiArray[d]->activate(m_control, m_window);
|
||||
|
||||
m_control->get_display().adjust_layout();
|
||||
m_control->display()->adjust_layout();
|
||||
}
|
||||
|
||||
// Does not delete disabled window.
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <torrent/peer.h>
|
||||
#include <sigc++/connection.h>
|
||||
|
||||
#include "display/manager.h"
|
||||
#include "utils/list_focus.h"
|
||||
|
||||
class Control;
|
||||
|
||||
+33
-30
@@ -44,8 +44,10 @@
|
||||
|
||||
#include "core/download.h"
|
||||
#include "core/download_factory.h"
|
||||
#include "core/manager.h"
|
||||
|
||||
#include "input/bindings.h"
|
||||
#include "input/manager.h"
|
||||
#include "input/path_input.h"
|
||||
|
||||
#include "display/window_http_queue.h"
|
||||
@@ -60,27 +62,28 @@
|
||||
#include "element_download_list.h"
|
||||
#include "element_log_complete.h"
|
||||
#include "element_string_list.h"
|
||||
#include "root.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
DownloadList::DownloadList(Control* c) :
|
||||
m_state(DISPLAY_MAX_SIZE),
|
||||
|
||||
m_window(c->get_display().end()),
|
||||
m_window(c->display()->end()),
|
||||
|
||||
m_windowTitle(new WTitle("rTorrent " VERSION " - libTorrent " + std::string(torrent::get_version()))),
|
||||
m_windowHttpQueue(new WHttp(&c->get_core().get_http_queue())),
|
||||
m_windowHttpQueue(new WHttp(&c->core()->get_http_queue())),
|
||||
|
||||
m_uiDownload(NULL),
|
||||
|
||||
m_downloadList(&c->get_core().get_download_list()),
|
||||
m_downloadList(&c->core()->get_download_list()),
|
||||
|
||||
m_control(c),
|
||||
m_bindings(new input::Bindings)
|
||||
{
|
||||
m_uiArray[DISPLAY_DOWNLOAD_LIST] = new ElementDownloadList(&m_downloadList);
|
||||
m_uiArray[DISPLAY_LOG] = new ElementLogComplete(&m_control->get_core().get_log_complete());
|
||||
m_windowLog = new WLog(&m_control->get_core().get_log_important());
|
||||
m_uiArray[DISPLAY_LOG] = new ElementLogComplete(&m_control->core()->get_log_complete());
|
||||
m_windowLog = new WLog(&m_control->core()->get_log_important());
|
||||
|
||||
m_taskUpdate.set_iterator(utils::taskScheduler.end());
|
||||
m_taskUpdate.set_slot(sigc::mem_fun(*this, &DownloadList::task_update)),
|
||||
@@ -113,13 +116,13 @@ DownloadList::activate() {
|
||||
|
||||
m_windowTextInput->set_active(false);
|
||||
|
||||
m_control->get_display().push_front(m_windowTextInput);
|
||||
m_control->get_display().push_front(m_windowHttpQueue);
|
||||
m_control->get_display().push_front(m_windowLog);
|
||||
m_window = m_control->get_display().insert(m_control->get_display().begin(), NULL);
|
||||
m_control->get_display().push_front(m_windowTitle);
|
||||
m_control->display()->push_front(m_windowTextInput);
|
||||
m_control->display()->push_front(m_windowHttpQueue);
|
||||
m_control->display()->push_front(m_windowLog);
|
||||
m_window = m_control->display()->insert(m_control->display()->begin(), NULL);
|
||||
m_control->display()->push_front(m_windowTitle);
|
||||
|
||||
m_control->get_input().push_front(m_bindings);
|
||||
m_control->input()->push_front(m_bindings);
|
||||
|
||||
activate_display(DISPLAY_DOWNLOAD_LIST);
|
||||
}
|
||||
@@ -138,15 +141,15 @@ DownloadList::disable() {
|
||||
|
||||
utils::taskScheduler.erase(&m_taskUpdate);
|
||||
|
||||
m_control->get_display().erase(m_window);
|
||||
m_control->get_display().erase(m_windowTitle);
|
||||
m_control->get_display().erase(m_windowTextInput);
|
||||
m_control->get_display().erase(m_windowLog);
|
||||
m_control->get_display().erase(m_windowHttpQueue);
|
||||
m_control->display()->erase(m_window);
|
||||
m_control->display()->erase(m_windowTitle);
|
||||
m_control->display()->erase(m_windowTextInput);
|
||||
m_control->display()->erase(m_windowLog);
|
||||
m_control->display()->erase(m_windowHttpQueue);
|
||||
|
||||
m_window = m_control->get_display().end();
|
||||
m_window = m_control->display()->end();
|
||||
|
||||
m_control->get_input().erase(m_bindings);
|
||||
m_control->input()->erase(m_bindings);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -160,7 +163,7 @@ DownloadList::activate_display(Display d) {
|
||||
m_state = d;
|
||||
m_uiArray[d]->activate(m_control, m_window);
|
||||
|
||||
m_control->get_display().adjust_layout();
|
||||
m_control->display()->adjust_layout();
|
||||
}
|
||||
|
||||
// Does not delete disabled window.
|
||||
@@ -187,7 +190,7 @@ DownloadList::receive_start_download() {
|
||||
if (m_downloadList.get_focus() == m_downloadList.end())
|
||||
return;
|
||||
|
||||
m_control->get_core().start(*m_downloadList.get_focus());
|
||||
m_control->core()->start(*m_downloadList.get_focus());
|
||||
}
|
||||
|
||||
void
|
||||
@@ -196,9 +199,9 @@ DownloadList::receive_stop_download() {
|
||||
return;
|
||||
|
||||
if ((*m_downloadList.get_focus())->get_download().is_active())
|
||||
m_control->get_core().stop(*m_downloadList.get_focus());
|
||||
m_control->core()->stop(*m_downloadList.get_focus());
|
||||
else
|
||||
m_downloadList.set_focus(m_control->get_core().erase(m_downloadList.get_focus()));
|
||||
m_downloadList.set_focus(m_control->core()->erase(m_downloadList.get_focus()));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -228,7 +231,7 @@ DownloadList::receive_exit_download() {
|
||||
|
||||
activate();
|
||||
|
||||
m_control->get_display().adjust_layout();
|
||||
m_control->display()->adjust_layout();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -236,7 +239,7 @@ DownloadList::receive_check_hash() {
|
||||
if (m_downloadList.get_focus() == m_downloadList.end())
|
||||
return;
|
||||
|
||||
m_control->get_core().check_hash(*m_downloadList.get_focus());
|
||||
m_control->core()->check_hash(*m_downloadList.get_focus());
|
||||
}
|
||||
|
||||
void
|
||||
@@ -244,11 +247,11 @@ DownloadList::receive_view_input(bool useDefault) {
|
||||
if (m_windowTextInput->get_active())
|
||||
return;
|
||||
|
||||
m_control->get_ui().window_statusbar()->set_active(false);
|
||||
m_control->ui()->window_statusbar()->set_active(false);
|
||||
m_windowTextInput->set_active(true);
|
||||
m_control->get_display().adjust_layout();
|
||||
m_control->display()->adjust_layout();
|
||||
|
||||
m_control->get_input().set_text_input(m_windowTextInput->get_input());
|
||||
m_control->input()->set_text_input(m_windowTextInput->get_input());
|
||||
|
||||
m_windowTextInput->set_focus(true);
|
||||
|
||||
@@ -261,13 +264,13 @@ DownloadList::receive_exit_input(bool useDefault) {
|
||||
if (!m_windowTextInput->get_active())
|
||||
return;
|
||||
|
||||
m_control->get_ui().window_statusbar()->set_active(true);
|
||||
m_control->ui()->window_statusbar()->set_active(true);
|
||||
m_windowTextInput->set_active(false);
|
||||
|
||||
m_control->get_input().set_text_input();
|
||||
m_control->input()->set_text_input();
|
||||
|
||||
// Adding download.
|
||||
core::DownloadFactory* f = new core::DownloadFactory(m_windowTextInput->get_input()->str(), &m_control->get_core());
|
||||
core::DownloadFactory* f = new core::DownloadFactory(m_windowTextInput->get_input()->str(), m_control->core());
|
||||
|
||||
f->set_start(useDefault);
|
||||
f->slot_finished(sigc::bind(sigc::ptr_fun(&rak::call_delete_func<core::DownloadFactory>), f));
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <sigc++/slot.h>
|
||||
|
||||
#include "core/download_list.h"
|
||||
#include "display/manager.h"
|
||||
#include "utils/task.h"
|
||||
#include "utils/list_focus.h"
|
||||
|
||||
@@ -90,7 +91,7 @@ public:
|
||||
|
||||
input::Bindings& get_bindings() { return *m_bindings; }
|
||||
|
||||
bool is_active() const { return m_window != m_control->get_display().end(); }
|
||||
bool is_active() const { return m_window != m_control->display()->end(); }
|
||||
|
||||
void activate();
|
||||
void disable();
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <stdexcept>
|
||||
|
||||
#include "display/window_download_list.h"
|
||||
#include "input/manager.h"
|
||||
|
||||
#include "control.h"
|
||||
#include "element_download_list.h"
|
||||
@@ -55,7 +56,7 @@ ElementDownloadList::activate(Control* c, MItr mItr) {
|
||||
if (m_window != NULL)
|
||||
throw std::logic_error("ui::ElementDownloadList::activate(...) called on an object in the wrong state");
|
||||
|
||||
c->get_input().push_front(&m_bindings);
|
||||
c->input()->push_front(&m_bindings);
|
||||
|
||||
*mItr = m_window = new WDownloadList(m_list);
|
||||
}
|
||||
@@ -65,7 +66,7 @@ ElementDownloadList::disable(Control* c) {
|
||||
if (m_window == NULL)
|
||||
throw std::logic_error("ui::ElementDownloadList::disable(...) called on an object in the wrong state");
|
||||
|
||||
c->get_input().erase(&m_bindings);
|
||||
c->input()->erase(&m_bindings);
|
||||
|
||||
delete m_window;
|
||||
m_window = NULL;
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <stdexcept>
|
||||
|
||||
#include "display/window_file_list.h"
|
||||
#include "input/manager.h"
|
||||
|
||||
#include "control.h"
|
||||
#include "element_file_list.h"
|
||||
@@ -61,7 +62,7 @@ ElementFileList::activate(Control* c, MItr mItr) {
|
||||
if (m_window != NULL)
|
||||
throw std::logic_error("ui::ElementFileList::activate(...) called on an object in the wrong state");
|
||||
|
||||
c->get_input().push_front(&m_bindings);
|
||||
c->input()->push_front(&m_bindings);
|
||||
|
||||
*mItr = m_window = new WFileList(m_download, &m_focus);
|
||||
}
|
||||
@@ -71,7 +72,7 @@ ElementFileList::disable(Control* c) {
|
||||
if (m_window == NULL)
|
||||
throw std::logic_error("ui::ElementFileList::disable(...) called on an object in the wrong state");
|
||||
|
||||
c->get_input().erase(&m_bindings);
|
||||
c->input()->erase(&m_bindings);
|
||||
|
||||
delete m_window;
|
||||
m_window = NULL;
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <stdexcept>
|
||||
|
||||
#include "display/window_log_complete.h"
|
||||
#include "input/manager.h"
|
||||
|
||||
#include "control.h"
|
||||
#include "element_log_complete.h"
|
||||
@@ -55,7 +56,7 @@ ElementLogComplete::activate(Control* c, MItr mItr) {
|
||||
if (m_window != NULL)
|
||||
throw std::logic_error("ui::ElementLogComplete::activate(...) called on an object in the wrong state");
|
||||
|
||||
c->get_input().push_front(&m_bindings);
|
||||
c->input()->push_front(&m_bindings);
|
||||
|
||||
*mItr = m_window = new WLogComplete(m_log);
|
||||
}
|
||||
@@ -65,7 +66,7 @@ ElementLogComplete::disable(Control* c) {
|
||||
if (m_window == NULL)
|
||||
throw std::logic_error("ui::ElementLogComplete::disable(...) called on an object in the wrong state");
|
||||
|
||||
c->get_input().erase(&m_bindings);
|
||||
c->input()->erase(&m_bindings);
|
||||
|
||||
delete m_window;
|
||||
m_window = NULL;
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <stdexcept>
|
||||
|
||||
#include "display/window_peer_info.h"
|
||||
#include "input/manager.h"
|
||||
|
||||
#include "control.h"
|
||||
#include "element_peer_info.h"
|
||||
@@ -58,7 +59,7 @@ ElementPeerInfo::activate(Control* c, MItr mItr) {
|
||||
if (m_window != NULL)
|
||||
throw std::logic_error("ui::ElementPeerInfo::activate(...) called on an object in the wrong state");
|
||||
|
||||
c->get_input().push_front(&m_bindings);
|
||||
c->input()->push_front(&m_bindings);
|
||||
|
||||
*mItr = m_window = new WPeerInfo(m_download, m_list, m_focus);
|
||||
}
|
||||
@@ -68,7 +69,7 @@ ElementPeerInfo::disable(Control* c) {
|
||||
if (m_window == NULL)
|
||||
throw std::logic_error("ui::ElementPeerInfo::disable(...) called on an object in the wrong state");
|
||||
|
||||
c->get_input().erase(&m_bindings);
|
||||
c->input()->erase(&m_bindings);
|
||||
|
||||
delete m_window;
|
||||
m_window = NULL;
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <stdexcept>
|
||||
|
||||
#include "display/window_peer_list.h"
|
||||
#include "input/manager.h"
|
||||
|
||||
#include "control.h"
|
||||
#include "element_peer_list.h"
|
||||
@@ -58,7 +59,7 @@ ElementPeerList::activate(Control* c, MItr mItr) {
|
||||
if (m_window != NULL)
|
||||
throw std::logic_error("ui::ElementPeerList::activate(...) called on an object in the wrong state");
|
||||
|
||||
c->get_input().push_front(&m_bindings);
|
||||
c->input()->push_front(&m_bindings);
|
||||
|
||||
*mItr = m_window = new WPeerList(m_download, m_list, m_focus);
|
||||
}
|
||||
@@ -68,7 +69,7 @@ ElementPeerList::disable(Control* c) {
|
||||
if (m_window == NULL)
|
||||
throw std::logic_error("ui::ElementPeerList::disable(...) called on an object in the wrong state");
|
||||
|
||||
c->get_input().erase(&m_bindings);
|
||||
c->input()->erase(&m_bindings);
|
||||
|
||||
delete m_window;
|
||||
m_window = NULL;
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "input/manager.h"
|
||||
|
||||
#include "control.h"
|
||||
#include "element_string_list.h"
|
||||
|
||||
@@ -52,7 +54,7 @@ ElementStringList::activate(Control* c, MItr mItr) {
|
||||
if (m_window != NULL)
|
||||
throw std::logic_error("ui::ElementStringList::activate(...) called on an object in the wrong state");
|
||||
|
||||
c->get_input().push_front(&m_bindings);
|
||||
c->input()->push_front(&m_bindings);
|
||||
|
||||
*mItr = m_window = new WStringList();
|
||||
|
||||
@@ -64,7 +66,7 @@ ElementStringList::disable(Control* c) {
|
||||
if (m_window == NULL)
|
||||
throw std::logic_error("ui::ElementStringList::disable(...) called on an object in the wrong state");
|
||||
|
||||
c->get_input().erase(&m_bindings);
|
||||
c->input()->erase(&m_bindings);
|
||||
|
||||
delete m_window;
|
||||
m_window = NULL;
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <stdexcept>
|
||||
|
||||
#include "display/window_tracker_list.h"
|
||||
#include "input/manager.h"
|
||||
|
||||
#include "control.h"
|
||||
#include "element_tracker_list.h"
|
||||
@@ -60,7 +61,7 @@ ElementTrackerList::activate(Control* c, MItr mItr) {
|
||||
if (m_window != NULL)
|
||||
throw std::logic_error("ui::ElementTrackerList::activate(...) called on an object in the wrong state");
|
||||
|
||||
c->get_input().push_front(&m_bindings);
|
||||
c->input()->push_front(&m_bindings);
|
||||
|
||||
*mItr = m_window = new WTrackerList(m_download, &m_focus);
|
||||
}
|
||||
@@ -70,7 +71,7 @@ ElementTrackerList::disable(Control* c) {
|
||||
if (m_window == NULL)
|
||||
throw std::logic_error("ui::ElementTrackerList::disable(...) called on an object in the wrong state");
|
||||
|
||||
c->get_input().erase(&m_bindings);
|
||||
c->input()->erase(&m_bindings);
|
||||
|
||||
delete m_window;
|
||||
m_window = NULL;
|
||||
|
||||
+9
-7
@@ -40,9 +40,11 @@
|
||||
#include <sigc++/bind.h>
|
||||
#include <torrent/torrent.h>
|
||||
|
||||
#include "display/window_statusbar.h"
|
||||
#include "input/manager.h"
|
||||
|
||||
#include "control.h"
|
||||
#include "download_list.h"
|
||||
#include "display/window_statusbar.h"
|
||||
|
||||
#include "root.h"
|
||||
|
||||
@@ -62,10 +64,10 @@ Root::init(Control* c) {
|
||||
m_control = c;
|
||||
setup_keys();
|
||||
|
||||
m_windowStatusbar = new WStatusbar(&m_control->get_core());
|
||||
m_windowStatusbar = new WStatusbar(m_control->core());
|
||||
m_downloadList = new DownloadList(m_control);
|
||||
|
||||
m_control->get_display().push_back(m_windowStatusbar);
|
||||
m_control->display()->push_back(m_windowStatusbar);
|
||||
|
||||
m_downloadList->activate();
|
||||
// m_downloadList->slot_open_uri(sigc::mem_fun(m_control->get_core(), &core::Manager::insert));
|
||||
@@ -79,18 +81,18 @@ Root::cleanup() {
|
||||
if (m_downloadList->is_active())
|
||||
m_downloadList->disable();
|
||||
|
||||
m_control->get_display().erase(m_windowStatusbar);
|
||||
m_control->display()->erase(m_windowStatusbar);
|
||||
|
||||
delete m_downloadList;
|
||||
delete m_windowStatusbar;
|
||||
|
||||
m_control->get_input().erase(&m_bindings);
|
||||
m_control->input()->erase(&m_bindings);
|
||||
m_control = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
Root::setup_keys() {
|
||||
m_control->get_input().push_back(&m_bindings);
|
||||
m_control->input()->push_back(&m_bindings);
|
||||
|
||||
m_bindings['a'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_up_throttle), 1);
|
||||
m_bindings['z'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_up_throttle), -1);
|
||||
@@ -106,7 +108,7 @@ Root::setup_keys() {
|
||||
m_bindings['D'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_down_throttle), 50);
|
||||
m_bindings['C'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_down_throttle), -50);
|
||||
|
||||
m_bindings[KEY_RESIZE] = sigc::mem_fun(m_control->get_display(), &display::Manager::adjust_layout);
|
||||
m_bindings[KEY_RESIZE] = sigc::mem_fun(*m_control->display(), &display::Manager::adjust_layout);
|
||||
m_bindings['\x11'] = sigc::mem_fun(*m_control, &Control::receive_shutdown);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user