mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-15 06:32:31 +00:00
* Created ThreadBase holding poll manager, etc, and added a this_thread global object.
* Cleaned up main initialization, SCGI and polling code. * Fixed a bug that would cause reading of a piece to hang if the incoming data contains only data up to the file boundary, but not the next file's data. The bug did not trigger if the file boundary and piece boundaries were the same. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1101 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+3
-39
@@ -158,10 +158,9 @@ Manager::push_log(const char* msg) {
|
||||
}
|
||||
|
||||
Manager::Manager() :
|
||||
m_hashingView(NULL),
|
||||
|
||||
m_pollManager(NULL) {
|
||||
|
||||
m_hashingView(NULL)
|
||||
// m_pollManager(NULL) {
|
||||
{
|
||||
m_downloadStore = new DownloadStore();
|
||||
m_downloadList = new DownloadList();
|
||||
m_fileStatusCache = new FileStatusCache();
|
||||
@@ -216,40 +215,6 @@ Manager::get_address_throttle(const sockaddr* addr) {
|
||||
return m_addressThrottles.get(rak::socket_address::cast_from(addr)->sa_inet()->address_h(), torrent::ThrottlePair(NULL, NULL));
|
||||
}
|
||||
|
||||
void
|
||||
Manager::initialize_first() {
|
||||
const char* poll = getenv("RTORRENT_POLL");
|
||||
if (poll != NULL) {
|
||||
if (!strcmp(poll, "epoll"))
|
||||
m_pollManager = PollManagerEPoll::create(sysconf(_SC_OPEN_MAX));
|
||||
else if (!strcmp(poll, "kqueue"))
|
||||
m_pollManager = PollManagerKQueue::create(sysconf(_SC_OPEN_MAX));
|
||||
else if (!strcmp(poll, "select"))
|
||||
m_pollManager = PollManagerSelect::create(sysconf(_SC_OPEN_MAX));
|
||||
|
||||
if (m_pollManager == NULL)
|
||||
m_logImportant.push_front(std::string("Cannot enable '") + poll + "' based polling.");
|
||||
}
|
||||
|
||||
if (m_pollManager != NULL)
|
||||
m_logImportant.push_front(std::string("Using '") + poll + "' based polling.");
|
||||
|
||||
else if ((m_pollManager = PollManagerEPoll::create(sysconf(_SC_OPEN_MAX))) != NULL)
|
||||
m_logImportant.push_front("Using 'epoll' based polling.");
|
||||
|
||||
else if ((m_pollManager = PollManagerKQueue::create(sysconf(_SC_OPEN_MAX))) != NULL)
|
||||
m_logImportant.push_front("Using 'kqueue' based polling.");
|
||||
|
||||
else if ((m_pollManager = PollManagerSelect::create(sysconf(_SC_OPEN_MAX))) != NULL)
|
||||
m_logImportant.push_front("Using 'select' based polling.");
|
||||
|
||||
else
|
||||
throw std::runtime_error("Could not create any PollManager.");
|
||||
|
||||
// Need to initialize this before parseing options.
|
||||
torrent::initialize(m_pollManager->get_torrent_poll());
|
||||
}
|
||||
|
||||
// Most of this should be possible to move out.
|
||||
void
|
||||
Manager::initialize_second() {
|
||||
@@ -276,7 +241,6 @@ Manager::cleanup() {
|
||||
delete m_httpStack;
|
||||
CurlStack::global_cleanup();
|
||||
|
||||
delete m_pollManager;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user