diff --git a/.gitignore b/.gitignore index 96013546..dac80bef 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,4 @@ TAGS ########################### src/rtorrent test/rtorrentTest +test-driver diff --git a/configure.ac b/configure.ac index 9ff7b544..2e6a9eb5 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_INIT(rtorrent, 0.9.3, jaris@ifi.uio.no) AC_DEFINE(API_VERSION, 8, api version) AM_INIT_AUTOMAKE -AM_CONFIG_HEADER(config.h) +AC_CONFIG_HEADERS(config.h) AM_PATH_CPPUNIT(1.9.6) AC_PROG_CXX diff --git a/src/core/view_manager.h b/src/core/view_manager.h index e2ef1ab2..750d210b 100644 --- a/src/core/view_manager.h +++ b/src/core/view_manager.h @@ -97,9 +97,6 @@ public: void set_event_added(const std::string& name, const torrent::Object& cmd) { (*find_throw(name))->set_event_added(cmd); } void set_event_removed(const std::string& name, const torrent::Object& cmd) { (*find_throw(name))->set_event_removed(cmd); } - -private: - DownloadList* m_list; }; } diff --git a/src/display/window_download_transfer_list.cc b/src/display/window_download_transfer_list.cc index 25a59d12..f8d2ff47 100644 --- a/src/display/window_download_transfer_list.cc +++ b/src/display/window_download_transfer_list.cc @@ -50,8 +50,7 @@ namespace display { WindowDownloadTransferList::WindowDownloadTransferList(core::Download* d, unsigned int *focus) : Window(new Canvas, 0, 0, 0, extent_full, extent_full), - m_download(d), - m_focus(focus) { + m_download(d) { } void diff --git a/src/display/window_download_transfer_list.h b/src/display/window_download_transfer_list.h index a61c7009..4e3febb8 100644 --- a/src/display/window_download_transfer_list.h +++ b/src/display/window_download_transfer_list.h @@ -71,8 +71,6 @@ private: char key_id(torrent::BlockTransfer::key_type key); core::Download* m_download; - - unsigned int* m_focus; assigned_vector m_assigned; }; diff --git a/src/main.cc b/src/main.cc index 843037f6..5221581a 100644 --- a/src/main.cc +++ b/src/main.cc @@ -202,9 +202,15 @@ main(int argc, char** argv) { SignalHandler::set_sigaction_handler(SIGBUS, &handle_sigbus); - // SIGUSR1 is used for interrupting polling, forcing that thread - // to process new non-socket events. - SignalHandler::set_handler(SIGUSR1, sigc::ptr_fun(&do_nothing)); + // SIGUSR1 is used for interrupting polling, forcing the target + // thread to process new non-socket events. + // + // LibTorrent uses sockets for this purpose on Solaris and other + // platforms that do not properly pass signals to the target + // threads. Use '--enable-interrupt-socket' when configuring + // LibTorrent to enable this workaround. + if (torrent::thread_base::should_handle_sigusr1()) + SignalHandler::set_handler(SIGUSR1, sigc::ptr_fun(&do_nothing)); torrent::log_add_group_output(torrent::LOG_NOTICE, "important"); torrent::log_add_group_output(torrent::LOG_INFO, "complete"); diff --git a/src/rpc/scgi.cc b/src/rpc/scgi.cc index 3daa7e57..f992718c 100644 --- a/src/rpc/scgi.cc +++ b/src/rpc/scgi.cc @@ -169,12 +169,12 @@ SCgi::receive_call(SCgiTask* task, const char* buffer, uint32_t length) { slot_write slotWrite; slotWrite.set(rak::mem_fn(task, &SCgiTask::receive_write)); - ThreadBase::acquire_global_lock(); - ThreadBase::interrupt_main_polling(); + torrent::thread_base::acquire_global_lock(); + torrent::main_thread()->interrupt(); bool result = xmlrpc.process(buffer, length, slotWrite); - ThreadBase::release_global_lock(); + torrent::thread_base::release_global_lock(); return result; } diff --git a/src/thread_base.cc b/src/thread_base.cc index 19dab3b0..a61a1201 100644 --- a/src/thread_base.cc +++ b/src/thread_base.cc @@ -160,20 +160,5 @@ ThreadBase::queue_item(thread_base_func newFunc) { // Make it also restart inactive threads? if (m_state == STATE_ACTIVE) - pthread_kill(m_thread, SIGUSR1); -} - -void -ThreadBase::interrupt_main_polling() { - int sleep_length = 0; - - while (ThreadBase::is_main_polling()) { - pthread_kill(torrent::main_thread()->pthread(), SIGUSR1); - - if (!ThreadBase::is_main_polling()) - return; - - usleep(sleep_length); - sleep_length = std::min(sleep_length + 50, 1000); - } + interrupt(); } diff --git a/src/thread_base.h b/src/thread_base.h index 479e3cdd..b125ea8b 100644 --- a/src/thread_base.h +++ b/src/thread_base.h @@ -66,14 +66,6 @@ public: void queue_item(thread_base_func newFunc); - // Only call this when global lock has been acquired, as it checks - // ThreadBase::is_main_polling() which is only guaranteed to remain - // 'false' if global lock keeps main thread from entering polling - // again. - // - // Move to libtorrent some day. - static void interrupt_main_polling(); - protected: int64_t next_timeout_usec();