mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-18 07:06:18 +00:00
Removed old poll creation calls.
This commit is contained in:
-13
@@ -11,7 +11,6 @@
|
|||||||
#include <torrent/http.h>
|
#include <torrent/http.h>
|
||||||
#include <torrent/torrent.h>
|
#include <torrent/torrent.h>
|
||||||
#include <torrent/exceptions.h>
|
#include <torrent/exceptions.h>
|
||||||
#include <torrent/poll.h>
|
|
||||||
#include <torrent/data/chunk_utils.h>
|
#include <torrent/data/chunk_utils.h>
|
||||||
#include <torrent/utils/log.h>
|
#include <torrent/utils/log.h>
|
||||||
#include <rak/error_number.h>
|
#include <rak/error_number.h>
|
||||||
@@ -132,16 +131,6 @@ client_perform() {
|
|||||||
control->inc_tick();
|
control->inc_tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
torrent::Poll*
|
|
||||||
create_poll() {
|
|
||||||
torrent::Poll* poll = torrent::Poll::create(sysconf(_SC_OPEN_MAX));
|
|
||||||
|
|
||||||
if (poll == nullptr)
|
|
||||||
throw torrent::internal_error("Unable to create poll object: " + std::string(std::strerror(errno)));
|
|
||||||
|
|
||||||
return poll;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char** argv) {
|
main(int argc, char** argv) {
|
||||||
try {
|
try {
|
||||||
@@ -159,8 +148,6 @@ main(int argc, char** argv) {
|
|||||||
srandom(random_seed);
|
srandom(random_seed);
|
||||||
srand48(random_seed);
|
srand48(random_seed);
|
||||||
|
|
||||||
torrent::Poll::slot_create_poll() = [](){ return create_poll(); };
|
|
||||||
|
|
||||||
torrent::initialize_main_thread();
|
torrent::initialize_main_thread();
|
||||||
torrent::log_initialize();
|
torrent::log_initialize();
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <rak/path.h>
|
#include <rak/path.h>
|
||||||
#include <torrent/exceptions.h>
|
#include <torrent/exceptions.h>
|
||||||
#include <torrent/poll.h>
|
|
||||||
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
@@ -22,7 +21,6 @@ ThreadWorker::~ThreadWorker() {
|
|||||||
|
|
||||||
void
|
void
|
||||||
ThreadWorker::init_thread() {
|
ThreadWorker::init_thread() {
|
||||||
m_poll = std::unique_ptr<torrent::Poll>(torrent::Poll::slot_create_poll()());
|
|
||||||
m_state = STATE_INITIALIZED;
|
m_state = STATE_INITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,6 @@
|
|||||||
|
|
||||||
std::unique_ptr<TestMainThread>
|
std::unique_ptr<TestMainThread>
|
||||||
TestMainThread::create() {
|
TestMainThread::create() {
|
||||||
if (torrent::Poll::slot_create_poll() == nullptr)
|
|
||||||
set_create_poll();
|
|
||||||
|
|
||||||
// Needs to be called before Thread is created.
|
// Needs to be called before Thread is created.
|
||||||
mock_redirect_defaults();
|
mock_redirect_defaults();
|
||||||
|
|
||||||
@@ -29,10 +26,6 @@ TestMainThread::~TestMainThread() {
|
|||||||
|
|
||||||
void
|
void
|
||||||
TestMainThread::init_thread() {
|
TestMainThread::init_thread() {
|
||||||
if (!torrent::Poll::slot_create_poll())
|
|
||||||
throw torrent::internal_error("ThreadMain::init_thread(): Poll::slot_create_poll() not valid.");
|
|
||||||
|
|
||||||
m_poll = std::unique_ptr<torrent::Poll>(torrent::Poll::slot_create_poll()());
|
|
||||||
m_resolver = std::make_unique<torrent::net::Resolver>();
|
m_resolver = std::make_unique<torrent::net::Resolver>();
|
||||||
m_state = STATE_INITIALIZED;
|
m_state = STATE_INITIALIZED;
|
||||||
|
|
||||||
|
|||||||
@@ -16,25 +16,6 @@ const int test_thread::test_flag_do_work;
|
|||||||
const int test_thread::test_flag_pre_poke;
|
const int test_thread::test_flag_pre_poke;
|
||||||
const int test_thread::test_flag_post_poke;
|
const int test_thread::test_flag_post_poke;
|
||||||
|
|
||||||
// TODO: Remove PollSelect.
|
|
||||||
|
|
||||||
torrent::Poll*
|
|
||||||
create_poll() {
|
|
||||||
torrent::Poll* poll = torrent::Poll::create(256);
|
|
||||||
|
|
||||||
if (poll == nullptr)
|
|
||||||
throw torrent::internal_error("Unable to create poll object");
|
|
||||||
|
|
||||||
return poll;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
set_create_poll() {
|
|
||||||
torrent::Poll::slot_create_poll() = []() {
|
|
||||||
return create_poll();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<test_thread>
|
std::unique_ptr<test_thread>
|
||||||
test_thread::create() {
|
test_thread::create() {
|
||||||
// Needs to be called before Thread is created.
|
// Needs to be called before Thread is created.
|
||||||
@@ -60,8 +41,6 @@ void
|
|||||||
test_thread::init_thread() {
|
test_thread::init_thread() {
|
||||||
m_state = STATE_INITIALIZED;
|
m_state = STATE_INITIALIZED;
|
||||||
m_test_state = TEST_PRE_START;
|
m_test_state = TEST_PRE_START;
|
||||||
|
|
||||||
m_poll = std::unique_ptr<torrent::Poll>(create_poll());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -55,19 +55,4 @@ private:
|
|||||||
std::atomic_int m_loop_count{0};
|
std::atomic_int m_loop_count{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
void set_create_poll();
|
|
||||||
|
|
||||||
// TODO: Need better cleanup here.
|
|
||||||
// TODO: Replace these with class that holds the threads and cleans them up on destruction.
|
|
||||||
|
|
||||||
#define SETUP_THREAD_DISK() \
|
|
||||||
auto thread_test = test_thread::create(); \
|
|
||||||
thread_test->init_thread(); \
|
|
||||||
torrent::ThreadDisk::create_thread(); \
|
|
||||||
torrent::thread_disk()->init_thread(); \
|
|
||||||
torrent::thread_disk()->start_thread();
|
|
||||||
|
|
||||||
#define CLEANUP_THREAD_DISK() \
|
|
||||||
torrent::ThreadDisk::destroy_thread();
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user