mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-17 23:52:30 +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:
+36
-12
@@ -38,20 +38,38 @@
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "core/manager.h"
|
||||
#include "display/canvas.h"
|
||||
#include "display/window.h"
|
||||
#include "display/manager.h"
|
||||
#include "input/manager.h"
|
||||
#include "input/input_event.h"
|
||||
#include "ui/root.h"
|
||||
|
||||
#include "control.h"
|
||||
|
||||
Control::Control() :
|
||||
m_shutdownReceived(false) {
|
||||
m_shutdownReceived(false),
|
||||
|
||||
m_ui(new ui::Root()),
|
||||
m_core(new core::Manager()),
|
||||
m_display(new display::Manager()),
|
||||
m_input(new input::Manager()),
|
||||
m_inputStdin(new input::InputEvent(STDIN_FILENO)) {
|
||||
|
||||
m_inputStdin = new input::InputEvent(STDIN_FILENO);
|
||||
m_inputStdin->slot_pressed(sigc::mem_fun(m_input, &input::Manager::pressed));
|
||||
|
||||
m_taskShutdown.set_iterator(utils::taskScheduler.end());
|
||||
m_taskShutdown.set_slot(sigc::mem_fun(*this, &Control::receive_shutdown));
|
||||
}
|
||||
|
||||
Control::~Control() {
|
||||
delete m_inputStdin;
|
||||
delete m_input;
|
||||
|
||||
delete m_ui;
|
||||
delete m_display;
|
||||
delete m_core;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -59,22 +77,24 @@ Control::initialize() {
|
||||
display::Canvas::initialize();
|
||||
display::Window::slot_adjust(sigc::mem_fun(m_display, &display::Manager::adjust_layout));
|
||||
|
||||
m_core.get_poll_manager()->signal_interrupted().connect(sigc::mem_fun(*m_inputStdin, &input::InputEvent::event_read));
|
||||
m_core.get_poll_manager()->signal_interrupted().connect(sigc::ptr_fun(display::Canvas::do_update));
|
||||
m_core->get_poll_manager()->signal_interrupted().connect(sigc::mem_fun(*m_inputStdin, &input::InputEvent::event_read));
|
||||
m_core->get_poll_manager()->signal_interrupted().connect(sigc::ptr_fun(display::Canvas::do_update));
|
||||
|
||||
m_core.initialize_second();
|
||||
m_core->initialize_second();
|
||||
|
||||
m_ui.init(this);
|
||||
m_ui->init(this);
|
||||
|
||||
m_inputStdin->insert(m_core.get_poll_manager()->get_torrent_poll());
|
||||
m_inputStdin->insert(m_core->get_poll_manager()->get_torrent_poll());
|
||||
}
|
||||
|
||||
void
|
||||
Control::cleanup() {
|
||||
m_inputStdin->remove(m_core.get_poll_manager()->get_torrent_poll());
|
||||
utils::taskScheduler.erase(&m_taskShutdown);
|
||||
|
||||
m_ui.cleanup();
|
||||
m_core.cleanup();
|
||||
m_inputStdin->remove(m_core->get_poll_manager()->get_torrent_poll());
|
||||
|
||||
m_ui->cleanup();
|
||||
m_core->cleanup();
|
||||
|
||||
display::Canvas::erase_std();
|
||||
display::Canvas::refresh_std();
|
||||
@@ -89,9 +109,13 @@ Control::receive_shutdown() {
|
||||
if (!m_shutdownReceived) {
|
||||
torrent::listen_close();
|
||||
|
||||
m_core.shutdown(false);
|
||||
m_core->shutdown(false);
|
||||
m_shutdownReceived = true;
|
||||
|
||||
if (!utils::taskScheduler.is_scheduled(&m_taskShutdown))
|
||||
utils::taskScheduler.insert(&m_taskShutdown, utils::Timer::cache() + 5 * 1000000);
|
||||
|
||||
} else {
|
||||
m_core.shutdown(true);
|
||||
m_core->shutdown(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user