diff --git a/src/Makefile.am b/src/Makefile.am index f70b0923..7493bdf6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -38,6 +38,8 @@ rtorrent_SOURCES = \ option_parser.cc \ option_parser.h \ signal_handler.cc \ - signal_handler.h + signal_handler.h \ + thread_base.cc \ + thread_base.h INCLUDES = -I$(srcdir) -I$(top_srcdir) diff --git a/src/command_download.cc b/src/command_download.cc index 5918aff2..60436622 100644 --- a/src/command_download.cc +++ b/src/command_download.cc @@ -298,6 +298,9 @@ torrent::Object retrieve_d_bitfield(core::Download* download) { const torrent::Bitfield* bitField = download->download()->file_list()->bitfield(); + if (bitField->empty()) + return torrent::Object(""); + return torrent::Object(rak::transform_hex(bitField->begin(), bitField->end())); } @@ -307,7 +310,7 @@ cmd_d_initialize_logs(core::Download* download) { download->download()->signal_network_log(sigc::mem_fun(control->core(), &core::Manager::push_log_complete)); download->download()->signal_storage_error(sigc::mem_fun(control->core(), &core::Manager::push_log_complete)); - if (!rpc::call_command_string("get_tracker_dump").empty()) + if (!rpc::call_command_string("get_log.tracker").empty()) download->download()->signal_tracker_dump(sigc::ptr_fun(&core::receive_tracker_dump)); return torrent::Object(); diff --git a/src/core/manager.cc b/src/core/manager.cc index d7a8c765..62738cab 100644 --- a/src/core/manager.cc +++ b/src/core/manager.cc @@ -77,7 +77,7 @@ namespace core { void receive_tracker_dump(const std::string& url, const char* data, size_t size) { - const std::string& filename = rpc::call_command_string("get_tracker_dump"); + const std::string& filename = rpc::call_command_string("get_log.tracker"); if (filename.empty()) return; diff --git a/src/globals.cc b/src/globals.cc index 2d04ddfe..42bec88a 100644 --- a/src/globals.cc +++ b/src/globals.cc @@ -42,5 +42,5 @@ rak::priority_queue_default taskScheduler; rak::timer cachedTime; Control* control = NULL; -//__thread utils::ThreadBase* this_thread = NULL; -utils::ThreadBase* this_thread = NULL; +//__thread ThreadBase* this_thread = NULL; +ThreadBase* this_thread = NULL; diff --git a/src/globals.h b/src/globals.h index 165d433b..ea25a3e5 100644 --- a/src/globals.h +++ b/src/globals.h @@ -40,7 +40,7 @@ #include #include -#include "utils/thread_base.h" +#include "thread_base.h" class Control; @@ -53,7 +53,7 @@ extern rak::priority_queue_default taskScheduler; extern rak::timer cachedTime; extern Control* control; -// extern __thread utils::ThreadBase* this_thread; // Only use for worker threads for now. -extern utils::ThreadBase* this_thread; // Only use for main threads for now. +// extern __thread ThreadBase* this_thread; // Only use for worker threads for now. +extern ThreadBase* this_thread; // Only use for main threads for now. #endif diff --git a/src/main.cc b/src/main.cc index 18e904bb..b8427178 100644 --- a/src/main.cc +++ b/src/main.cc @@ -154,7 +154,7 @@ main(int argc, char** argv) { control = new Control; - this_thread = new utils::ThreadBase(); + this_thread = new ThreadBase(); this_thread->init_thread(); srandom(cachedTime.usec()); diff --git a/src/rpc/exec_file.cc b/src/rpc/exec_file.cc index b2dd8acf..f1fb9018 100644 --- a/src/rpc/exec_file.cc +++ b/src/rpc/exec_file.cc @@ -123,6 +123,8 @@ ExecFile::execute(const char* file, char* const* argv, int flags) { m_capture += std::string(buffer, length); } while (length > 0); + ::close(pipeFd[0]); + if (m_logFd != -1) { write(m_logFd, "Captured output:\n", sizeof("Captured output:\n")); write(m_logFd, m_capture.data(), m_capture.length()); diff --git a/src/utils/thread_base.cc b/src/thread_base.cc similarity index 99% rename from src/utils/thread_base.cc rename to src/thread_base.cc index bef62b7e..dec63825 100644 --- a/src/utils/thread_base.cc +++ b/src/thread_base.cc @@ -43,8 +43,6 @@ #include "globals.h" -namespace utils { - // Temporarly injected into config.h. /* temp hack */ //#define __cacheline_aligned __attribute__((__aligned__(128))) @@ -155,5 +153,3 @@ ThreadBase::init_thread() { // ThreadBase::queue_item(thread_base_func newFunc) { // m_threadQueue->push_back(newFunc); // } - -} diff --git a/src/utils/thread_base.h b/src/thread_base.h similarity index 99% rename from src/utils/thread_base.h rename to src/thread_base.h index 1442710d..5684924b 100644 --- a/src/utils/thread_base.h +++ b/src/thread_base.h @@ -41,8 +41,6 @@ #include "rak/priority_queue_default.h" #include "core/poll_manager.h" -namespace utils { - struct thread_queue_hack; // Move this class to libtorrent. @@ -82,6 +80,4 @@ private: // thread_queue_hack* m_threadQueue; }; -} - #endif diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am index f2daa2bb..55ea9ff1 100644 --- a/src/utils/Makefile.am +++ b/src/utils/Makefile.am @@ -9,8 +9,6 @@ libsub_utils_a_SOURCES = \ lockfile.cc \ lockfile.h \ socket_fd.cc \ - socket_fd.h \ - thread_base.cc \ - thread_base.h + socket_fd.h INCLUDES = -I$(srcdir) -I$(srcdir)/.. -I$(top_srcdir)