From 370bae4b986ce541756491a0934d22db3cc69534 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Tue, 27 Aug 2013 00:43:23 +0900 Subject: [PATCH 01/24] Removed all dependencies on sigc++. --- configure.ac | 4 --- src/core/manager.cc | 4 +-- src/core/view.cc | 10 ++++-- src/core/view.h | 16 +++++---- src/display/window_download_list.cc | 17 ++++++--- src/display/window_download_list.h | 15 +++----- src/input/path_input.cc | 15 ++++---- src/input/path_input.h | 23 ++++++++----- src/ui/download.h | 1 - src/ui/download_list.cc | 13 +++---- src/utils/list_focus.h | 53 +++++++++++++++++++---------- 11 files changed, 101 insertions(+), 70 deletions(-) diff --git a/configure.ac b/configure.ac index 2e6a9eb5..d5a9e6f6 100644 --- a/configure.ac +++ b/configure.ac @@ -41,10 +41,6 @@ CFLAGS="$CFLAGS $PTHREAD_CFLAGS $CURSES_CFLAGS" CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS $CURSES_CFLAGS" LIBS="$PTHREAD_LIBS $CURSES_LIB $LIBS" -PKG_CHECK_MODULES(sigc, sigc++-2.0, - CXXFLAGS="$CXXFLAGS $sigc_CFLAGS"; - LIBS="$LIBS $sigc_LIBS") - PKG_CHECK_MODULES(libcurl, libcurl >= 7.15.4, CXXFLAGS="$CXXFLAGS $libcurl_CFLAGS"; LIBS="$LIBS $libcurl_LIBS") diff --git a/src/core/manager.cc b/src/core/manager.cc index 7cd58b76..c7373e22 100644 --- a/src/core/manager.cc +++ b/src/core/manager.cc @@ -47,8 +47,6 @@ #include #include #include -#include -#include #include #include #include @@ -115,7 +113,7 @@ Manager::set_hashing_view(View* v) { throw torrent::internal_error("Manager::set_hashing_view(...) received NULL or is already set."); m_hashingView = v; - v->signal_changed().connect(sigc::mem_fun(this, &Manager::receive_hashing_changed)); + m_hashingView->signal_changed().push_back(std::tr1::bind(&Manager::receive_hashing_changed, this)); } torrent::ThrottlePair diff --git a/src/core/view.cc b/src/core/view.cc index 871f98ee..1b5fc09c 100644 --- a/src/core/view.cc +++ b/src/core/view.cc @@ -138,12 +138,18 @@ struct view_downloads_filter : std::unary_function { const torrent::Object& m_command; }; -inline void +void View::emit_changed() { priority_queue_erase(&taskScheduler, &m_delayChanged); priority_queue_insert(&taskScheduler, &m_delayChanged, cachedTime); } +void +View::emit_changed_now() { + for (signal_void::iterator itr = m_signal_changed.begin(), last = m_signal_changed.end(); itr != last; itr++) + (*itr)(); +} + View::~View() { if (m_name.empty()) return; @@ -171,7 +177,7 @@ View::initialize(const std::string& name) { m_focus = 0; set_last_changed(rak::timer()); - m_delayChanged.slot() = std::tr1::bind(&signal_type::operator(), &m_signalChanged); + m_delayChanged.slot() = std::tr1::bind(&View::emit_changed_now, this); } void diff --git a/src/core/view.h b/src/core/view.h index 98d366d3..69d9fb79 100644 --- a/src/core/view.h +++ b/src/core/view.h @@ -52,8 +52,8 @@ #include #include #include -#include #include +#include #include "globals.h" @@ -63,8 +63,9 @@ class Download; class View : private std::vector { public: - typedef std::vector base_type; - typedef sigc::signal0 signal_type; + typedef std::vector base_type; + typedef std::tr1::function slot_void; + typedef std::list signal_void; using base_type::iterator; using base_type::const_iterator; @@ -101,7 +102,7 @@ public: iterator focus() { return begin() + m_focus; } const_iterator focus() const { return begin() + m_focus; } - void set_focus(iterator itr) { m_focus = position(itr); m_signalChanged.emit(); } + void set_focus(iterator itr) { m_focus = position(itr); emit_changed(); } void insert(Download* download) { base_type::push_back(download); } void erase(Download* download); @@ -143,7 +144,7 @@ public: // Don't connect any slots until after initialize else it get's // triggered when adding the Download's in DownloadList. - signal_type& signal_changed() { return m_signalChanged; } + signal_void& signal_changed() { return m_signal_changed; } private: View(const View&); @@ -154,7 +155,8 @@ private: inline void insert_visible(Download* d); inline void erase_internal(iterator itr); - inline void emit_changed(); + void emit_changed(); + void emit_changed_now(); size_type position(const_iterator itr) const { return itr - begin(); } @@ -176,7 +178,7 @@ private: rak::timer m_lastChanged; - signal_type m_signalChanged; + signal_void m_signal_changed; rak::priority_item m_delayChanged; }; diff --git a/src/display/window_download_list.cc b/src/display/window_download_list.cc index 0b407138..ead4ddda 100644 --- a/src/display/window_download_list.cc +++ b/src/display/window_download_list.cc @@ -48,18 +48,27 @@ namespace display { +WindowDownloadList::WindowDownloadList() : + Window(new Canvas, 0, 120, 1, extent_full, extent_full), + m_view(NULL) { +} + WindowDownloadList::~WindowDownloadList() { - m_connChanged.disconnect(); + if (m_view != NULL) + m_view->signal_changed().erase(m_changed_itr); + + m_view = NULL; } void WindowDownloadList::set_view(core::View* l) { + if (m_view != NULL) + m_view->signal_changed().erase(m_changed_itr); + m_view = l; - m_connChanged.disconnect(); - if (m_view != NULL) - m_connChanged = m_view->signal_changed().connect(sigc::mem_fun(*this, &Window::mark_dirty)); + m_changed_itr = m_view->signal_changed().insert(m_view->signal_changed().begin(), std::tr1::bind(&Window::mark_dirty, this)); } void diff --git a/src/display/window_download_list.h b/src/display/window_download_list.h index 0fed0c18..8e15cac9 100644 --- a/src/display/window_download_list.h +++ b/src/display/window_download_list.h @@ -37,23 +37,18 @@ #ifndef RTORRENT_DISPLAY_WINDOW_DOWNLOAD_LIST_H #define RTORRENT_DISPLAY_WINDOW_DOWNLOAD_LIST_H -#include - #include "window.h" #include "core/download_list.h" - -namespace core { - class View; -} +#include "core/view.h" namespace display { class WindowDownloadList : public Window { public: - WindowDownloadList() : - Window(new Canvas, 0, 120, 1, extent_full, extent_full), - m_view(NULL) {} + typedef core::View::signal_void::iterator signal_void_itr; + + WindowDownloadList(); ~WindowDownloadList(); virtual void redraw(); @@ -63,7 +58,7 @@ public: private: core::View* m_view; - sigc::connection m_connChanged; + signal_void_itr m_changed_itr; }; } diff --git a/src/input/path_input.cc b/src/input/path_input.cc index 2b951b28..04b22f17 100644 --- a/src/input/path_input.cc +++ b/src/input/path_input.cc @@ -67,7 +67,8 @@ PathInput::pressed(int key) { return TextInput::pressed(key); } else if (m_showNext) { - m_signalShowNext.emit(); + for (signal_void::iterator itr = m_signal_show_next.begin(), last = m_signal_show_next.end(); itr != last; itr++) + (*itr)(); } else { receive_do_complete(); @@ -101,7 +102,7 @@ PathInput::receive_do_complete() { std::for_each(dir.begin(), dir.end(), _transform_filename()); - Range r = find_incomplete(dir, str().substr(dirEnd, get_pos())); + range_type r = find_incomplete(dir, str().substr(dirEnd, get_pos())); if (r.first == r.second) return; // Show some nice colors here. @@ -121,8 +122,10 @@ PathInput::receive_do_complete() { // Only emit if there are more than one option. m_showNext = ++utils::Directory::iterator(r.first) != r.second; - if (m_showNext) - m_signalShowRange.emit(r.first, r.second); + if (m_showNext) { + for (signal_itr_itr::iterator itr = m_signal_show_range.begin(), last = m_signal_show_range.end(); itr != last; itr++) + (*itr)(r.first, r.second); + } } PathInput::size_type @@ -147,9 +150,9 @@ find_complete_not_compare(const utils::directory_entry& complete, const std::str return !complete.d_name.compare(0, base.size(), base); } -PathInput::Range +PathInput::range_type PathInput::find_incomplete(utils::Directory& d, const std::string& f) { - Range r; + range_type r; r.first = std::find_if(d.begin(), d.end(), rak::bind2nd(std::ptr_fun(&find_complete_not_compare), f)); r.second = std::find_if(r.first, d.end(), rak::bind2nd(std::ptr_fun(&find_complete_compare), f)); diff --git a/src/input/path_input.h b/src/input/path_input.h index 3564aca2..5134f70f 100644 --- a/src/input/path_input.h +++ b/src/input/path_input.h @@ -37,7 +37,8 @@ #ifndef RTORRENT_INPUT_PATH_INPUT_H #define RTORRENT_INPUT_PATH_INPUT_H -#include +#include +#include #include "utils/directory.h" #include "text_input.h" @@ -46,15 +47,19 @@ namespace input { class PathInput : public TextInput { public: - typedef std::pair Range; - typedef sigc::signal0 Signal; - typedef sigc::signal2 SignalShowRange; + typedef utils::Directory::iterator directory_itr; + typedef std::pair range_type; + + typedef std::tr1::function slot_void; + typedef std::tr1::function slot_itr_itr; + typedef std::list signal_void; + typedef std::list signal_itr_itr; PathInput(); virtual ~PathInput() {} - Signal& signal_show_next() { return m_signalShowNext; } - SignalShowRange& signal_show_range() { return m_signalShowRange; } + signal_void& signal_show_next() { return m_signal_show_next; } + signal_itr_itr& signal_show_range() { return m_signal_show_range; } virtual bool pressed(int key); @@ -62,12 +67,12 @@ private: void receive_do_complete(); size_type find_last_delim(); - Range find_incomplete(utils::Directory& d, const std::string& f); + range_type find_incomplete(utils::Directory& d, const std::string& f); bool m_showNext; - Signal m_signalShowNext; - SignalShowRange m_signalShowRange; + signal_void m_signal_show_next; + signal_itr_itr m_signal_show_range; }; } diff --git a/src/ui/download.h b/src/ui/download.h index b00622d6..c896c528 100644 --- a/src/ui/download.h +++ b/src/ui/download.h @@ -39,7 +39,6 @@ #include #include -#include #include "display/manager.h" #include "utils/list_focus.h" diff --git a/src/ui/download_list.cc b/src/ui/download_list.cc index 78227e83..58f4646f 100644 --- a/src/ui/download_list.cc +++ b/src/ui/download_list.cc @@ -38,8 +38,6 @@ #include #include -#include -#include #include #include #include @@ -270,11 +268,14 @@ DownloadList::receive_view_input(Input type) { ElementStringList* esl = dynamic_cast(m_uiArray[DISPLAY_STRING_LIST]); - input->signal_show_next().connect(std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_STRING_LIST)); - input->signal_show_next().connect(std::tr1::bind(&ElementStringList::next_screen, *esl)); + input->signal_show_next().push_back(std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_STRING_LIST)); + input->signal_show_next().push_back(std::tr1::bind(&ElementStringList::next_screen, *esl)); - input->signal_show_range().connect(sigc::hide(sigc::hide(std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_STRING_LIST)))); - input->signal_show_range().connect(sigc::mem_fun(*esl, &ElementStringList::set_range_dirent)); + input->signal_show_range().push_back(std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_STRING_LIST)); + input->signal_show_range().push_back(std::tr1::bind(&ElementStringList::set_range_dirent, + *esl, + std::tr1::placeholders::_1, + std::tr1::placeholders::_2)); input->bindings()['\n'] = std::tr1::bind(&DownloadList::receive_exit_input, this, type); input->bindings()[KEY_ENTER] = std::tr1::bind(&DownloadList::receive_exit_input, this, type); diff --git a/src/utils/list_focus.h b/src/utils/list_focus.h index 5ad3ed4c..25cc0af6 100644 --- a/src/utils/list_focus.h +++ b/src/utils/list_focus.h @@ -37,7 +37,7 @@ #ifndef RTORRENT_UTILS_LIST_FOCUS_H #define RTORRENT_UTILS_LIST_FOCUS_H -#include +#include namespace utils { @@ -46,15 +46,18 @@ namespace utils { template class ListFocus { public: - typedef typename Base::iterator iterator; - typedef typename Base::const_iterator const_iterator; - typedef typename Base::reverse_iterator reverse_iterator; - typedef typename Base::const_reverse_iterator const_reverse_iterator; + typedef Base base_type; + typedef std::tr1::function slot_void; + typedef std::list signal_void; - typedef typename Base::value_type value_type; - typedef sigc::signal0 Signal; + typedef typename base_type::iterator iterator; + typedef typename base_type::const_iterator const_iterator; + typedef typename base_type::reverse_iterator reverse_iterator; + typedef typename base_type::const_reverse_iterator const_reverse_iterator; - ListFocus(Base* b = NULL) : m_base(b) { if (b) m_focus = b->end(); } + typedef typename base_type::value_type value_type; + + ListFocus(base_type* b = NULL) : m_base(b) { if (b) m_focus = b->end(); } // Convinience functions, would have added more through using, but // can't. @@ -64,10 +67,10 @@ public: reverse_iterator rend() { return m_base->rend(); } // Don't do erase on this object without making sure focus is right. - Base& base() { return *m_base; } + base_type& base() { return *m_base; } iterator get_focus() { return m_focus; } - void set_focus(iterator itr) { m_focus = itr; m_signalChanged.emit(); } + void set_focus(iterator itr); // These are looping increment/decrements. iterator inc_focus(); @@ -77,15 +80,24 @@ public: void remove(const value_type& v); // Be careful with copying signals. - Signal& signal_changed() { return m_signalChanged; } + signal_void& signal_changed() { return m_signal_changed; } private: - Base* m_base; + void emit_changed(); + + base_type* m_base; iterator m_focus; - Signal m_signalChanged; + signal_void m_signal_changed; }; +template +void +ListFocus::set_focus(iterator itr) { + m_focus = itr; + emit_changed(); +} + template typename ListFocus::iterator ListFocus::inc_focus() { @@ -94,8 +106,7 @@ ListFocus::inc_focus() { else m_focus = begin(); - m_signalChanged.emit(); - + emit_changed(); return m_focus; } @@ -107,8 +118,7 @@ ListFocus::dec_focus() { else m_focus = end(); - m_signalChanged.emit(); - + emit_changed(); return m_focus; } @@ -120,7 +130,7 @@ ListFocus::erase(iterator itr) { else return m_base->erase(itr); - m_signalChanged.emit(); + emit_changed(); } template @@ -136,6 +146,13 @@ ListFocus::remove(const value_type& v) { ++first; } +template +void +ListFocus::emit_changed() { + for (signal_void::iterator itr = m_signal_changed.begin(), last = m_signal_changed.end(); itr != last; itr++) + (*itr)(); +} + } #endif From 00a349f68c18b2171626707454b7da37a4a50178 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Tue, 27 Aug 2013 23:18:31 +0900 Subject: [PATCH 02/24] Added slot_call_list. --- rak/functional.h | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/rak/functional.h b/rak/functional.h index cc149dbf..ac77b2da 100644 --- a/rak/functional.h +++ b/rak/functional.h @@ -627,6 +627,57 @@ make_mem_fun(Object* o, Ret (Object::*f)(Arg1, Arg2, Arg3)) { return mem_fun3(o, f); } +template +inline void +slot_list_call(const Container& slot_list) { + if (slot_list.empty()) + return; + + typename Container::const_iterator first = slot_list.begin(); + typename Container::const_iterator next = slot_list.begin(); + + while (++next != slot_list.end()) { + (*first)(); + first = next; + } + + (*first)(); +} + +template +inline void +slot_list_call(const Container& slot_list, Arg1 arg1) { + if (slot_list.empty()) + return; + + typename Container::const_iterator first = slot_list.begin(); + typename Container::const_iterator next = slot_list.begin(); + + while (++next != slot_list.end()) { + (*first)(arg1); + first = next; + } + + (*first)(arg1); +} + +template +inline void +slot_list_call(const Container& slot_list, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4) { + if (slot_list.empty()) + return; + + typename Container::const_iterator first = slot_list.begin(); + typename Container::const_iterator next = slot_list.begin(); + + while (++next != slot_list.end()) { + (*first)(arg1, arg2, arg3, arg4); + first = next; + } + + (*first)(arg1, arg2, arg3, arg4); +} + } #endif From 66edb398636fe53efba61a5f3d026ef302a80c6e Mon Sep 17 00:00:00 2001 From: rakshasa Date: Fri, 30 Aug 2013 00:09:08 +0900 Subject: [PATCH 03/24] Added 'log.open_gz_file' option. --- src/command_local.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/command_local.cc b/src/command_local.cc index df5af765..45c63b89 100644 --- a/src/command_local.cc +++ b/src/command_local.cc @@ -287,6 +287,16 @@ apply_log_open_file(const torrent::Object::list_type& args) { return torrent::Object(); } +torrent::Object +apply_log_open_gz_file(const torrent::Object::list_type& args) { + if (args.size() != 2) + throw torrent::input_error("Invalid number of arguments."); + + torrent::log_open_gz_file_output(args.front().as_string().c_str(), + rak::path_expand(args.back().as_string()).c_str()); + return torrent::Object(); +} + torrent::Object apply_log_add_output(const torrent::Object::list_type& args) { if (args.size() != 2) @@ -391,8 +401,9 @@ initialize_command_local() { CMD2_EXECUTE ("execute.capture", rpc::ExecFile::flag_throw | rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_capture); CMD2_EXECUTE ("execute.capture_nothrow", rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_capture); - CMD2_ANY_LIST ("log.open_file", tr1::bind(&apply_log_open_file, tr1::placeholders::_2)); - CMD2_ANY_LIST ("log.add_output", tr1::bind(&apply_log_add_output, tr1::placeholders::_2)); + CMD2_ANY_LIST ("log.open_file", tr1::bind(&apply_log_open_file, tr1::placeholders::_2)); + CMD2_ANY_LIST ("log.open_gz_file", tr1::bind(&apply_log_open_gz_file, tr1::placeholders::_2)); + CMD2_ANY_LIST ("log.add_output", tr1::bind(&apply_log_add_output, tr1::placeholders::_2)); CMD2_ANY_STRING ("log.execute", tr1::bind(&apply_log, tr1::placeholders::_2, 0)); CMD2_ANY_STRING ("log.vmmap.dump", tr1::bind(&log_vmmap_dump, tr1::placeholders::_2)); From 67236d77579d0687011a0c6eb3d6fc72dc9f9792 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Wed, 6 Nov 2013 23:22:54 +0900 Subject: [PATCH 04/24] Fixed an issue with input window. --- src/ui/download_list.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/download_list.cc b/src/ui/download_list.cc index 58f4646f..e3abc9ac 100644 --- a/src/ui/download_list.cc +++ b/src/ui/download_list.cc @@ -269,11 +269,11 @@ DownloadList::receive_view_input(Input type) { ElementStringList* esl = dynamic_cast(m_uiArray[DISPLAY_STRING_LIST]); input->signal_show_next().push_back(std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_STRING_LIST)); - input->signal_show_next().push_back(std::tr1::bind(&ElementStringList::next_screen, *esl)); + input->signal_show_next().push_back(std::tr1::bind(&ElementStringList::next_screen, esl)); input->signal_show_range().push_back(std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_STRING_LIST)); input->signal_show_range().push_back(std::tr1::bind(&ElementStringList::set_range_dirent, - *esl, + esl, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); From 2e9baa1635d107716b239a8f175766e5a085949e Mon Sep 17 00:00:00 2001 From: rakshasa Date: Wed, 6 Nov 2013 23:23:20 +0900 Subject: [PATCH 05/24] Added logging of some ui events. --- src/input/path_input.cc | 5 +++++ src/ui/element_string_list.cc | 7 +++++++ src/ui/element_string_list.h | 21 +++++++++++++++++---- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/input/path_input.cc b/src/input/path_input.cc index 04b22f17..461d850f 100644 --- a/src/input/path_input.cc +++ b/src/input/path_input.cc @@ -42,6 +42,7 @@ #include #include +#include #ifdef __sun__ #include @@ -90,6 +91,8 @@ struct _transform_filename { void PathInput::receive_do_complete() { + lt_log_print(torrent::LOG_UI_EVENTS, "path_input: received completion"); + size_type dirEnd = find_last_delim(); utils::Directory dir(dirEnd != 0 ? str().substr(0, dirEnd) : "./"); @@ -123,6 +126,8 @@ PathInput::receive_do_complete() { m_showNext = ++utils::Directory::iterator(r.first) != r.second; if (m_showNext) { + lt_log_print(torrent::LOG_UI_EVENTS, "path_input: show next page"); + for (signal_itr_itr::iterator itr = m_signal_show_range.begin(), last = m_signal_show_range.end(); itr != last; itr++) (*itr)(r.first, r.second); } diff --git a/src/ui/element_string_list.cc b/src/ui/element_string_list.cc index f57b3f97..79f1adf2 100644 --- a/src/ui/element_string_list.cc +++ b/src/ui/element_string_list.cc @@ -55,6 +55,8 @@ ElementStringList::activate(display::Frame* frame, bool focus) { if (is_active()) throw torrent::internal_error("ui::ElementStringList::activate(...) is_active()."); + lt_log_print(torrent::LOG_UI_EVENTS, "element_string_list: activate"); + control->input()->push_back(&m_bindings); m_window = new WStringList(); @@ -69,6 +71,8 @@ ElementStringList::disable() { if (!is_active()) throw torrent::internal_error("ui::ElementStringList::disable(...) !is_active()."); + lt_log_print(torrent::LOG_UI_EVENTS, "element_string_list: deactivate"); + control->input()->erase(&m_bindings); m_frame->clear(); @@ -80,6 +84,9 @@ ElementStringList::disable() { void ElementStringList::next_screen() { + if (m_window == NULL) + return; + if (m_window->get_draw_end() != m_list.end()) m_window->set_range(m_window->get_draw_end(), m_list.end()); else diff --git a/src/ui/element_string_list.h b/src/ui/element_string_list.h index fcd4b749..e034988b 100644 --- a/src/ui/element_string_list.h +++ b/src/ui/element_string_list.h @@ -41,6 +41,7 @@ #include #include #include +#include #include "element_base.h" @@ -69,8 +70,14 @@ public: while (first != last) m_list.push_back(*(first++)); - m_window->set_range(m_list.begin(), m_list.end()); - m_window->mark_dirty(); + if (m_window != NULL) { + lt_log_print(torrent::LOG_UI_EVENTS, "element_string_list: set range (visible)"); + + m_window->set_range(m_list.begin(), m_list.end()); + m_window->mark_dirty(); + } else { + lt_log_print(torrent::LOG_UI_EVENTS, "element_string_list: set range (hidden)"); + } } // A hack, clean this up. @@ -81,8 +88,14 @@ public: while (first != last) m_list.push_back((first++)->d_name); - m_window->set_range(m_list.begin(), m_list.end()); - m_window->mark_dirty(); + if (m_window != NULL) { + lt_log_print(torrent::LOG_UI_EVENTS, "element_string_list: set dirent range (visible)"); + + m_window->set_range(m_list.begin(), m_list.end()); + m_window->mark_dirty(); + } else { + lt_log_print(torrent::LOG_UI_EVENTS, "element_string_list: set dirent range (hidden)"); + } } void next_screen(); From 385b342debbdab607fca6bfbf012a13c5828f808 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Fri, 22 Nov 2013 23:03:00 +0900 Subject: [PATCH 06/24] Fixed typo in IPv6 option. --- scripts/common.m4 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/common.m4 b/scripts/common.m4 index 9c043e59..af2dc7bc 100644 --- a/scripts/common.m4 +++ b/scripts/common.m4 @@ -270,9 +270,21 @@ AC_DEFUN([TORRENT_ENABLE_ALIGNED], [ ]) +AC_DEFUN([TORRENT_ENABLE_INTERRUPT_SOCKET], [ + AC_ARG_ENABLE(interrupt-socket, + [ --enable-interrupt-socket enable interrupt socket [[default=off]]], + [ + if test "$enableval" = "yes"; then + AC_DEFINE(USE_INTERRUPT_SOCKET, 1, Use interrupt socket instead of pthread_kill) + fi + ] + ) +]) + + AC_DEFUN([TORRENT_DISABLE_IPV6], [ AC_ARG_ENABLE(ipv6, - [ --enable-ipv6 disable ipv6 [[default=no]]], + [ --enable-ipv6 enable ipv6 [[default=no]]], [ if test "$enableval" = "yes"; then AC_DEFINE(RAK_USE_INET6, 1, enable ipv6 stuff) From 55b826d6cbfb94f9932ab97d1d4ec698e491744d Mon Sep 17 00:00:00 2001 From: rakshasa Date: Fri, 22 Nov 2013 23:20:50 +0900 Subject: [PATCH 07/24] Added brackets around configure parameters. --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index d5a9e6f6..3c6f482b 100644 --- a/configure.ac +++ b/configure.ac @@ -41,11 +41,11 @@ CFLAGS="$CFLAGS $PTHREAD_CFLAGS $CURSES_CFLAGS" CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS $CURSES_CFLAGS" LIBS="$PTHREAD_LIBS $CURSES_LIB $LIBS" -PKG_CHECK_MODULES(libcurl, libcurl >= 7.15.4, +PKG_CHECK_MODULES([libcurl], libcurl >= 7.15.4, CXXFLAGS="$CXXFLAGS $libcurl_CFLAGS"; LIBS="$LIBS $libcurl_LIBS") -PKG_CHECK_MODULES(libtorrent, libtorrent >= 0.13.3, +PKG_CHECK_MODULES([libtorrent], libtorrent >= 0.13.3, CXXFLAGS="$CXXFLAGS $libtorrent_CFLAGS"; LIBS="$LIBS $libtorrent_LIBS") From 0d620e77db53b28b1c15bcfe92bf0ede66974946 Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Sun, 17 Nov 2013 12:15:08 +0530 Subject: [PATCH 08/24] rtorrent.1.xml: remove schedule and schedule_remove They were deprecated a long time ago. Signed-off-by: Ramkumar Ramachandra --- doc/old/rtorrent.1.xml | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/doc/old/rtorrent.1.xml b/doc/old/rtorrent.1.xml index 9c455859..76d2401d 100644 --- a/doc/old/rtorrent.1.xml +++ b/doc/old/rtorrent.1.xml @@ -507,29 +507,6 @@ Enable/disable peer exchange for torrents that aren't marked private. Disabled b - - schedule = id,start,interval,command - -Call command every interval -seconds, starting from start. An -interval of zero calls the task once, while a -start of zero calls it immediately. Currently -command is forwarded to the option handler. - -start and interval may -optionally use a time format, dd:hh:mm:ss. F.ex to -start a task every day at 18:00, use -18:00:00,24:00:00. - - - - - schedule_remove = id - -Delete id from the scheduler. - - - start_tied = From 89dfa3a2682b558a741f1af60d6ff968f09ff508 Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Sun, 17 Nov 2013 12:20:02 +0530 Subject: [PATCH 09/24] rtorrent.1.xml: clearly demarcate DHT settings DHT stuff is clearly demarcated in the code, so let the manual also follow along. Signed-off-by: Ramkumar Ramachandra --- doc/old/rtorrent.1.xml | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/doc/old/rtorrent.1.xml b/doc/old/rtorrent.1.xml index 76d2401d..f14c3566 100644 --- a/doc/old/rtorrent.1.xml +++ b/doc/old/rtorrent.1.xml @@ -723,6 +723,27 @@ not allow connections to UDP trackers. + + http_capath = path + http_cacert = filename + +Set the certificates to use in http requests. See Curl's +CURLOPT_CAPATH and CURLOPT_CAINFO options for further information. + + + + + + + + + DHT-RELATED SETTINGS + + Settings related to DHT + + + + dht = disabled|off|auto|on @@ -755,20 +776,10 @@ The port is optional, with port 6881 being used by default. - - http_capath = path - http_cacert = filename - -Set the certificates to use in http requests. See Curl's -CURLOPT_CAPATH and CURLOPT_CAINFO options for further information. - - - - USER-INTERFACE SETTINGS From 58fba68aff785b7a9f83c58ef92cbf6feb6ff37f Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Sun, 17 Nov 2013 12:25:39 +0530 Subject: [PATCH 10/24] rtorrent.1.xml: add more DHT variables Use TODO placeholders for the moment. Signed-off-by: Ramkumar Ramachandra --- doc/old/rtorrent.1.xml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/doc/old/rtorrent.1.xml b/doc/old/rtorrent.1.xml index f14c3566..8239229a 100644 --- a/doc/old/rtorrent.1.xml +++ b/doc/old/rtorrent.1.xml @@ -776,6 +776,27 @@ The port is optional, with port 6881 being used by default. + + dht_statistics = TODO + +TODO + + + + + set_dht_port = TODO + +TODO + + + + + set_dht_throttle = TODO + +TODO + + + From fe5439f6a06b313dc0134b178608f0d4e7c4e173 Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Sun, 17 Nov 2013 12:39:45 +0530 Subject: [PATCH 11/24] rtorrent.1.xml: document set_* functions for throttle Signed-off-by: Ramkumar Ramachandra --- doc/old/rtorrent.1.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/old/rtorrent.1.xml b/doc/old/rtorrent.1.xml index 8239229a..57dfd0b4 100644 --- a/doc/old/rtorrent.1.xml +++ b/doc/old/rtorrent.1.xml @@ -606,6 +606,8 @@ commands are available. upload_rate = KB download_rate = KB + set_upload_rate = TODO + set_download_rate = TODO Set the maximum global uploand and download rates. @@ -638,6 +640,8 @@ Set the maximum number of simultaneous uploads per download. max_uploads_div = value max_downloads_div = value + set_max_uploads_div = value + set_max_downloads_div = value Change the divider used to calculate the max upload and download slots to use when the throttle is changed. Disable by @@ -648,6 +652,8 @@ setting 0. max_uploads_global = value max_downloads_global = value + set_max_uploads_global = value + set_max_downloads_global = value Max upload and download slots allowed. Disable by setting 0. From effdc5642d704b4900cd3ebaf8fd120db6a767a9 Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Sun, 17 Nov 2013 12:40:40 +0530 Subject: [PATCH 12/24] rtorrent.1.xml: document (max|min)_(uploads|downloads) Only max_uploads was documented previously. Signed-off-by: Ramkumar Ramachandra --- doc/old/rtorrent.1.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/old/rtorrent.1.xml b/doc/old/rtorrent.1.xml index 57dfd0b4..17de1237 100644 --- a/doc/old/rtorrent.1.xml +++ b/doc/old/rtorrent.1.xml @@ -632,8 +632,11 @@ Set the minimum nad maximum number of peers to allow while seeding, or max_uploads = value + max_downloads = value + min_uploads = value + min_downloads = value -Set the maximum number of simultaneous uploads per download. +Set the maximum/minimum number of simultaneous uploads/downloads per download/upload. From 9fcef7fbd61fbd4b23dc3045363cc4b3ca0f140c Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Sun, 17 Nov 2013 12:43:20 +0530 Subject: [PATCH 13/24] rtorrent.1.xml: nuke a bunch of deprecated on_* functions Signed-off-by: Ramkumar Ramachandra --- doc/old/rtorrent.1.xml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/doc/old/rtorrent.1.xml b/doc/old/rtorrent.1.xml index 17de1237..bca55f9c 100644 --- a/doc/old/rtorrent.1.xml +++ b/doc/old/rtorrent.1.xml @@ -574,23 +574,6 @@ Use with the schedule option. - - on_insert = id,command - on_erase = id,command - on_open = id,command - on_close = id,command - on_start = id,command - on_stop = id,command - on_hash_queued = id,command - on_hash_removed = id,command - on_hash_done = id,command - on_finished = id,command - -Call a command on a download when its state changes. Only a subset of -commands are available. - - - From a5d92cc9400ddf5e560806e2a7969414e30e885b Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Sun, 17 Nov 2013 12:45:03 +0530 Subject: [PATCH 14/24] rtorrent.1.xml: nuke deprecated stop_on_ratio Signed-off-by: Ramkumar Ramachandra --- doc/old/rtorrent.1.xml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/doc/old/rtorrent.1.xml b/doc/old/rtorrent.1.xml index bca55f9c..e8093896 100644 --- a/doc/old/rtorrent.1.xml +++ b/doc/old/rtorrent.1.xml @@ -557,23 +557,6 @@ torrent::input_error exception on bad input. - - stop_on_ratio = min_ratio - stop_on_ratio = min_ratio,min_upload - stop_on_ratio = min_ratio,min_upload,max_ratio - -Stop torrents when they reach the given upload ratio -min_ratio in percent. If the optional -min_upload is given, require a total -upload amount of this many bytes as well. If the optional -max_ratio is given, stop the torrent -when reaching this ratio regardless of the total upload -amount. Exclude certain torrent by pressing -Shift+I in the downlist list. -Use with the schedule option. - - - From 6b7adfd6bd16a570ef0864be27f3052b9bf0f75f Mon Sep 17 00:00:00 2001 From: rakshasa Date: Thu, 28 Nov 2013 01:53:20 +0900 Subject: [PATCH 15/24] Added scripts for gnuplot. --- doc/plot/instrumentation_transfers.sh | 31 +++++++++++++++++++++++++++ doc/plot/mincore.sh | 30 ++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100755 doc/plot/instrumentation_transfers.sh create mode 100755 doc/plot/mincore.sh diff --git a/doc/plot/instrumentation_transfers.sh b/doc/plot/instrumentation_transfers.sh new file mode 100755 index 00000000..698c792d --- /dev/null +++ b/doc/plot/instrumentation_transfers.sh @@ -0,0 +1,31 @@ +#/bin/bash +gnuplot << EOF + +set terminal png size 1024,768 enhanced +set xdata time +set timefmt "%s" +set format x "%H:%M" +set y2tics +set autoscale xfix +set key autotitle columnhead + +set format y "%.0f" +set format y2 "%.0f" + +set output "output_$1_transfer_requests.png" +plot \ + "instrumentation_transfers.log.$1" using 1:2 title 'downloading' smooth sbezier with lines lw 4 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:3 title 'finished' smooth sbezier with lines lw 4 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:4 title 'skipped' smooth sbezier with lines lw 2 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:5 title 'unknown' smooth sbezier with lines lw 2 axis x1y2 + +set output "output_$1_transfer_queues.png" +plot \ + "instrumentation_transfers.log.$1" using 1:6 title 'queue added' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:7 title 'queue removed' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:8 title 'queue total' smooth sbezier with lines lw 4 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:9 title 'canceled added' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:10 title 'canceled removed' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:11 title 'canceled total' smooth sbezier with lines lw 4 axis x1y2 + +EOF diff --git a/doc/plot/mincore.sh b/doc/plot/mincore.sh new file mode 100755 index 00000000..3dfaa630 --- /dev/null +++ b/doc/plot/mincore.sh @@ -0,0 +1,30 @@ +#/bin/bash +gnuplot << EOF + +set terminal png size 1024,768 enhanced +set xdata time +set timefmt "%s" +set format x "%H:%M" +set y2tics +set autoscale xfix +set key autotitle columnhead + +set format y "%.0f" +set format y2 "%.0f" + +set output "output_$1_incore_sync.png" +plot \ + "instrumentation_mincore.log.$1" using 1:6 title 'success' smooth sbezier with lines lw 4 axis x1y1,\ + "instrumentation_mincore.log.$1" using 1:7 title 'failed' smooth sbezier with lines lw 4 axis x1y1,\ + "instrumentation_mincore.log.$1" using 1:8 title 'not synced' smooth sbezier with lines lw 4 axis x1y2,\ + "instrumentation_mincore.log.$1" using 1:9 title 'not deallocated' smooth sbezier with lines lw 4 axis x1y2 + +set format y "%.0g" + +set output "output_$1_incore_alloc.png" +plot \ + "instrumentation_mincore.log.$1" using 1:12 title 'allocations' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_mincore.log.$1" using 1:13 title 'deallocations' smooth sbezier with lines lw 4 axis x1y1,\ + "instrumentation_mincore.log.$1" using 1:10 title 'alloc failed' smooth sbezier with lines lw 2 axis x1y2 + +EOF From 866289b38aefbee3b8bfd5a86894d34cf4d7eab3 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Tue, 28 Jan 2014 23:29:05 +0900 Subject: [PATCH 16/24] Updated email address. --- configure.ac | 2 +- doc/plot/instrumentation_transfers.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 3c6f482b..1f6f14d6 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(rtorrent, 0.9.3, jaris@ifi.uio.no) +AC_INIT(rtorrent, 0.9.3, sundell.software@gmail.com) AC_DEFINE(API_VERSION, 8, api version) diff --git a/doc/plot/instrumentation_transfers.sh b/doc/plot/instrumentation_transfers.sh index 698c792d..5bae7e89 100755 --- a/doc/plot/instrumentation_transfers.sh +++ b/doc/plot/instrumentation_transfers.sh @@ -9,6 +9,8 @@ set y2tics set autoscale xfix set key autotitle columnhead +set datafile missing '0' + set format y "%.0f" set format y2 "%.0f" From 3e3a84b3a03e88974bcea57813a1857edeabf727 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Sun, 23 Mar 2014 14:46:10 +0100 Subject: [PATCH 17/24] Added 'network.listen.backlog{,.set}' commands. --- src/command_network.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/command_network.cc b/src/command_network.cc index 37998931..e6cfd081 100644 --- a/src/command_network.cc +++ b/src/command_network.cc @@ -247,7 +247,9 @@ initialize_command_network() { CMD2_VAR_BOOL ("network.port_random", true); CMD2_VAR_STRING ("network.port_range", "6881-6999"); - CMD2_ANY ("network.listen.port", tr1::bind(&torrent::ConnectionManager::listen_port, cm)); + CMD2_ANY ("network.listen.port", tr1::bind(&torrent::ConnectionManager::listen_port, cm)); + CMD2_ANY ("network.listen.backlog", tr1::bind(&torrent::ConnectionManager::listen_backlog, cm)); + CMD2_ANY_VALUE_V ("network.listen.backlog.set", tr1::bind(&torrent::ConnectionManager::set_listen_backlog, cm, tr1::placeholders::_2)); CMD2_VAR_BOOL ("protocol.pex", true); CMD2_ANY_LIST ("protocol.encryption.set", tr1::bind(&apply_encryption, tr1::placeholders::_2)); From dea7c80996ec5a98394a2c418f12ae2e53cb4a48 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Tue, 1 Apr 2014 01:03:44 +0200 Subject: [PATCH 18/24] Updated instrumenation transfer plot script. --- doc/plot/instrumentation_transfers.sh | 30 ++++++++++++++++++--------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/doc/plot/instrumentation_transfers.sh b/doc/plot/instrumentation_transfers.sh index 5bae7e89..01644986 100755 --- a/doc/plot/instrumentation_transfers.sh +++ b/doc/plot/instrumentation_transfers.sh @@ -14,20 +14,30 @@ set datafile missing '0' set format y "%.0f" set format y2 "%.0f" +set y2range [0:] + set output "output_$1_transfer_requests.png" plot \ - "instrumentation_transfers.log.$1" using 1:2 title 'downloading' smooth sbezier with lines lw 4 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:3 title 'finished' smooth sbezier with lines lw 4 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:4 title 'skipped' smooth sbezier with lines lw 2 axis x1y2,\ - "instrumentation_transfers.log.$1" using 1:5 title 'unknown' smooth sbezier with lines lw 2 axis x1y2 + "instrumentation_transfers.log.$1" using 1:2 title 'delegated' smooth sbezier with lines lw 4 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:3 title 'downloading' smooth sbezier with lines lw 4 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:4 title 'finished' smooth sbezier with lines lw 4 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:5 title 'skipped' smooth sbezier with lines lw 2 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:6 title 'unknown' smooth sbezier with lines lw 2 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:19 title 'unaccounted' smooth sbezier with lines lw 2 axis x1y2 set output "output_$1_transfer_queues.png" plot \ - "instrumentation_transfers.log.$1" using 1:6 title 'queue added' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:7 title 'queue removed' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:8 title 'queue total' smooth sbezier with lines lw 4 axis x1y2,\ - "instrumentation_transfers.log.$1" using 1:9 title 'canceled added' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:10 title 'canceled removed' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:11 title 'canceled total' smooth sbezier with lines lw 4 axis x1y2 + "instrumentation_transfers.log.$1" using 1:7 title 'queue added' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:8 title 'queue moved' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:9 title 'queue removed' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:10 title 'queue total' smooth sbezier with lines lw 4 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:11 title 'canceled added' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:12 title 'canceled moved' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:13 title 'canceled removed' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:14 title 'canceled total' smooth sbezier with lines lw 4 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:15 title 'choked added' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:16 title 'choked moved' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:17 title 'choked removed' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:18 title 'choked total' smooth sbezier with lines lw 4 axis x1y2 EOF From a536fc09a0ba03461df26ef5def4addbca3cb7e6 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Tue, 1 Apr 2014 11:49:19 +0200 Subject: [PATCH 19/24] Updated autoconf scripts. --- rak/timer.h | 3 +++ scripts/checks.m4 | 57 +++++++++++++++++++++++++++++++++++------------ scripts/common.m4 | 41 +++++++++++++++++++++++++--------- 3 files changed, 76 insertions(+), 25 deletions(-) diff --git a/rak/timer.h b/rak/timer.h index 67bdc1c7..e25ad2e6 100644 --- a/rak/timer.h +++ b/rak/timer.h @@ -49,6 +49,9 @@ class timer { timer(int64_t usec = 0) : m_time(usec) {} timer(timeval tv) : m_time((int64_t)(uint32_t)tv.tv_sec * 1000000 + (int64_t)(uint32_t)tv.tv_usec % 1000000) {} + bool is_zero() const { return m_time == 0; } + bool is_not_zero() const { return m_time != 0; } + int32_t seconds() const { return m_time / 1000000; } int32_t seconds_ceiling() const { return (m_time + 1000000 - 1) / 1000000; } int64_t usec() const { return m_time; } diff --git a/scripts/checks.m4 b/scripts/checks.m4 index 646e5406..598f39b3 100644 --- a/scripts/checks.m4 +++ b/scripts/checks.m4 @@ -21,9 +21,9 @@ AC_DEFUN([TORRENT_CHECK_XFS], [ AC_DEFUN([TORRENT_WITHOUT_XFS], [ AC_ARG_WITH(xfs, - [ --without-xfs Do not check for XFS filesystem support], + AC_HELP_STRING([--without-xfs], [do not check for XFS filesystem support]), [ - if test "$withval" = "yes"; then + if test "$withval" = "yes"; then TORRENT_CHECK_XFS fi ], [ @@ -34,7 +34,7 @@ AC_DEFUN([TORRENT_WITHOUT_XFS], [ AC_DEFUN([TORRENT_WITH_XFS], [ AC_ARG_WITH(xfs, - [ --with-xfs Check for XFS filesystem support], + AC_HELP_STRING([--with-xfs], [check for XFS filesystem support]), [ if test "$withval" = "yes"; then TORRENT_CHECK_XFS @@ -63,7 +63,7 @@ AC_DEFUN([TORRENT_CHECK_EPOLL], [ AC_DEFUN([TORRENT_WITHOUT_EPOLL], [ AC_ARG_WITH(epoll, - [ --without-epoll Do not check for epoll support.], + AC_HELP_STRING([--without-epoll], [do not check for epoll support]), [ if test "$withval" = "yes"; then TORRENT_CHECK_EPOLL @@ -133,7 +133,7 @@ AC_DEFUN([TORRENT_CHECK_KQUEUE_SOCKET_ONLY], [ AC_DEFUN([TORRENT_WITH_KQUEUE], [ AC_ARG_WITH(kqueue, - [ --with-kqueue enable kqueue. [[default=no]]], + AC_HELP_STRING([--with-kqueue], [enable kqueue [[default=no]]]), [ if test "$withval" = "yes"; then TORRENT_CHECK_KQUEUE @@ -145,7 +145,7 @@ AC_DEFUN([TORRENT_WITH_KQUEUE], [ AC_DEFUN([TORRENT_WITHOUT_KQUEUE], [ AC_ARG_WITH(kqueue, - [ --without-kqueue Do not check for kqueue support.], + AC_HELP_STRING([--without-kqueue], [do not check for kqueue support]), [ if test "$withval" = "yes"; then TORRENT_CHECK_KQUEUE @@ -160,8 +160,7 @@ AC_DEFUN([TORRENT_WITHOUT_KQUEUE], [ AC_DEFUN([TORRENT_WITHOUT_VARIABLE_FDSET], [ AC_ARG_WITH(variable-fdset, - - [ --without-variable-fdset do not use non-portable variable sized fd_set's.], + AC_HELP_STRING([--without-variable-fdset], [do not use non-portable variable sized fd_set's]), [ if test "$withval" = "yes"; then AC_DEFINE(USE_VARIABLE_FDSET, 1, defined when we allow the use of fd_set's of any size) @@ -205,7 +204,7 @@ AC_DEFUN([TORRENT_CHECK_POSIX_FALLOCATE], [ AC_DEFUN([TORRENT_WITH_POSIX_FALLOCATE], [ AC_ARG_WITH(posix-fallocate, - [ --with-posix-fallocate Check for and use posix_fallocate to allocate files.], + AC_HELP_STRING([--with-posix-fallocate], [check for and use posix_fallocate to allocate files]), [ if test "$withval" = "yes"; then TORRENT_CHECK_POSIX_FALLOCATE @@ -299,7 +298,7 @@ AC_DEFUN([TORRENT_DISABLED_STATFS], [ AC_DEFUN([TORRENT_WITHOUT_STATVFS], [ AC_ARG_WITH(statvfs, - [ --without-statvfs Don't try to use statvfs to find free diskspace.], + AC_HELP_STRING([--without-statvfs], [don't try to use statvfs to find free diskspace]), [ if test "$withval" = "yes"; then TORRENT_CHECK_STATVFS @@ -314,7 +313,7 @@ AC_DEFUN([TORRENT_WITHOUT_STATVFS], [ AC_DEFUN([TORRENT_WITHOUT_STATFS], [ AC_ARG_WITH(statfs, - [ --without-statfs Don't try to use statfs to find free diskspace.], + AC_HELP_STRING([--without-statfs], [don't try to use statfs to find free diskspace]), [ if test "$have_stat_vfs" = "no"; then if test "$withval" = "yes"; then @@ -336,7 +335,7 @@ AC_DEFUN([TORRENT_WITHOUT_STATFS], [ AC_DEFUN([TORRENT_WITH_ADDRESS_SPACE], [ AC_ARG_WITH(address-space, - AC_HELP_STRING([--with-address-space=MB], [Change the default address space size, default 1024 MB.]), + AC_HELP_STRING([--with-address-space=MB], [change the default address space size [[default=1024mb]]]), [ if test ! -z $withval -a "$withval" != "yes" -a "$withval" != "no"; then AC_DEFINE_UNQUOTED(DEFAULT_ADDRESS_SPACE_SIZE, [$withval]) @@ -402,7 +401,7 @@ AC_DEFUN([TORRENT_CHECK_CXX11], [ AC_DEFUN([TORRENT_WITH_FASTCGI], [ AC_ARG_WITH(fastcgi, - [ --with-fastcgi=PATH Enable FastCGI RPC support. (DO NOT USE)], + AC_HELP_STRING([--with-fastcgi=PATH], [enable FastCGI RPC support (DO NOT USE)]), [ AC_MSG_CHECKING([for FastCGI (DO NOT USE)]) @@ -451,7 +450,7 @@ AC_DEFUN([TORRENT_WITH_XMLRPC_C], [ AC_MSG_CHECKING(for XMLRPC-C) AC_ARG_WITH(xmlrpc-c, - [ --with-xmlrpc-c=PATH Enable XMLRPC-C support.], + AC_HELP_STRING([--with-xmlrpc-c=PATH], [enable XMLRPC-C support]), [ if test "$withval" = "no"; then AC_MSG_RESULT(no) @@ -508,3 +507,33 @@ AC_DEFUN([TORRENT_WITH_INOTIFY], [ AC_LANG_POP(C++) ]) + +AC_DEFUN([TORRENT_CHECK_PTHREAD_SETNAME_NP], [ + AC_CHECK_HEADERS(pthread.h) + + AC_MSG_CHECKING(for pthread_setname_np type) + + AC_TRY_LINK([ + #include + #include + ],[ + pthread_t t; + pthread_setname_np(t, "foo"); + ],[ + AC_DEFINE(HAS_PTHREAD_SETNAME_NP_GENERIC, 1, The function to set pthread name has a pthread_t argumet.) + AC_MSG_RESULT(generic) + ],[ + AC_TRY_LINK([ + #include + #include + ],[ + pthread_t t; + pthread_setname_np("foo"); + ],[ + AC_DEFINE(HAS_PTHREAD_SETNAME_NP_DARWIN, 1, The function to set pthread name has no pthread argument.) + AC_MSG_RESULT(darwin) + ],[ + AC_MSG_RESULT(no) + ]) + ]) +]) diff --git a/scripts/common.m4 b/scripts/common.m4 index af2dc7bc..51276242 100644 --- a/scripts/common.m4 +++ b/scripts/common.m4 @@ -13,7 +13,7 @@ AC_DEFUN([TORRENT_CHECK_CXXFLAGS], [ AC_DEFUN([TORRENT_ENABLE_DEBUG], [ AC_ARG_ENABLE(debug, - [ --enable-debug enable debug information [[default=yes]]], + AC_HELP_STRING([--enable-debug], [enable debug information [[default=yes]]]), [ if test "$enableval" = "yes"; then CXXFLAGS="$CXXFLAGS -g -DDEBUG" @@ -28,7 +28,7 @@ AC_DEFUN([TORRENT_ENABLE_DEBUG], [ AC_DEFUN([TORRENT_ENABLE_WERROR], [ AC_ARG_ENABLE(werror, - [ --enable-werror enable the -Werror and -Wall flag [[default=no]]], + AC_HELP_STRING([--enable-werror], [enable the -Werror and -Wall flag [[default=no]]]), [ if test "$enableval" = "yes"; then CXXFLAGS="$CXXFLAGS -Werror -Wall" @@ -39,7 +39,7 @@ AC_DEFUN([TORRENT_ENABLE_WERROR], [ AC_DEFUN([TORRENT_ENABLE_EXTRA_DEBUG], [ AC_ARG_ENABLE(extra-debug, - [ --enable-extra-debug enable extra debugging checks. [[default=no]]], + AC_HELP_STRING([--enable-extra-debug], [enable extra debugging checks [[default=no]]]), [ if test "$enableval" = "yes"; then AC_DEFINE(USE_EXTRA_DEBUG, 1, Enable extra debugging checks.) @@ -50,7 +50,7 @@ AC_DEFUN([TORRENT_ENABLE_EXTRA_DEBUG], [ AC_DEFUN([TORRENT_WITH_SYSROOT], [ AC_ARG_WITH(sysroot, - [ --with-sysroot=PATH compile and link with a specific sysroot.], + AC_HELP_STRING([--with-sysroot=PATH], [compile and link with a specific sysroot]), [ AC_MSG_CHECKING(for sysroot) @@ -72,7 +72,7 @@ AC_DEFUN([TORRENT_WITH_SYSROOT], [ AC_DEFUN([TORRENT_ENABLE_ARCH], [ AC_ARG_ENABLE(arch, - [ --enable-arch=ARCH comma seprated list of architectures to compile for.], + AC_HELP_STRING([--enable-arch=ARCH], [comma seprated list of architectures to compile for]), [ AC_MSG_CHECKING(for target architectures) @@ -152,7 +152,7 @@ AC_DEFUN([TORRENT_MINCORE_SIGNEDNESS], [ AC_DEFUN([TORRENT_MINCORE], [ AC_ARG_ENABLE(mincore, - [ --disable-mincore disable mincore check [[default=enable]]], + AC_HELP_STRING([--disable-mincore], [disable mincore check [[default=enable]]]), [ if test "$enableval" = "yes"; then TORRENT_MINCORE_SIGNEDNESS() @@ -259,7 +259,7 @@ AC_DEFUN([TORRENT_CHECK_ALIGNED], [ AC_DEFUN([TORRENT_ENABLE_ALIGNED], [ AC_ARG_ENABLE(aligned, - [ --enable-aligned enable alignment safe code [[default=check]]], + AC_HELP_STRING([--enable-aligned], [enable alignment safe code [[default=check]]]), [ if test "$enableval" = "yes"; then AC_DEFINE(USE_ALIGNED, 1, Require byte alignment) @@ -270,9 +270,28 @@ AC_DEFUN([TORRENT_ENABLE_ALIGNED], [ ]) +AC_DEFUN([TORRENT_DISABLE_INSTRUMENTATION], [ + AC_MSG_CHECKING([if instrumentation should be included]) + + AC_ARG_ENABLE(instrumentation, + AC_HELP_STRING([--disable-instrumentation], [disable instrumentation [[default=enabled]]]), + [ + if test "$enableval" = "yes"; then + AC_DEFINE(LT_INSTRUMENTATION, 1, enable instrumentation) + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + ],[ + AC_DEFINE(LT_INSTRUMENTATION, 1, enable instrumentation) + AC_MSG_RESULT(yes) + ]) +]) + + AC_DEFUN([TORRENT_ENABLE_INTERRUPT_SOCKET], [ AC_ARG_ENABLE(interrupt-socket, - [ --enable-interrupt-socket enable interrupt socket [[default=off]]], + AC_HELP_STRING([--enable-interrupt-socket], [enable interrupt socket [[default=no]]]), [ if test "$enableval" = "yes"; then AC_DEFINE(USE_INTERRUPT_SOCKET, 1, Use interrupt socket instead of pthread_kill) @@ -284,7 +303,7 @@ AC_DEFUN([TORRENT_ENABLE_INTERRUPT_SOCKET], [ AC_DEFUN([TORRENT_DISABLE_IPV6], [ AC_ARG_ENABLE(ipv6, - [ --enable-ipv6 enable ipv6 [[default=no]]], + AC_HELP_STRING([--enable-ipv6], [enable ipv6 [[default=no]]]), [ if test "$enableval" = "yes"; then AC_DEFINE(RAK_USE_INET6, 1, enable ipv6 stuff) @@ -294,7 +313,7 @@ AC_DEFUN([TORRENT_DISABLE_IPV6], [ AC_DEFUN([TORRENT_ENABLE_TR1], [ AC_ARG_ENABLE(std_tr1, - [ --disable-std_tr1 disable check for support for TR1 [[default=enable]]], + AC_HELP_STRING([--disable-std_tr1], [disable check for support for TR1 [[default=enable]]]), [ if test "$enableval" = "yes"; then TORRENT_CHECK_TR1() @@ -309,7 +328,7 @@ AC_DEFUN([TORRENT_ENABLE_TR1], [ AC_DEFUN([TORRENT_ENABLE_CXX11], [ AC_ARG_ENABLE(std_c++11, - [ --disable-std_c++11 disable check for support for C++11 [[default=enable]]], + AC_HELP_STRING([--disable-std_c++11], [disable check for support for C++11 [[default=enable]]]), [ if test "$enableval" = "yes"; then TORRENT_CHECK_CXX11() From 906683714b4fbfced745ec2553ef07dd1c9dd60b Mon Sep 17 00:00:00 2001 From: rakshasa Date: Thu, 10 Apr 2014 22:00:46 +0900 Subject: [PATCH 20/24] Updated instrumentation transfers plot script. --- doc/plot/instrumentation_transfers.sh | 28 +++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/doc/plot/instrumentation_transfers.sh b/doc/plot/instrumentation_transfers.sh index 01644986..4141a7bb 100755 --- a/doc/plot/instrumentation_transfers.sh +++ b/doc/plot/instrumentation_transfers.sh @@ -27,17 +27,21 @@ plot \ set output "output_$1_transfer_queues.png" plot \ - "instrumentation_transfers.log.$1" using 1:7 title 'queue added' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:8 title 'queue moved' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:9 title 'queue removed' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:10 title 'queue total' smooth sbezier with lines lw 4 axis x1y2,\ - "instrumentation_transfers.log.$1" using 1:11 title 'canceled added' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:12 title 'canceled moved' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:13 title 'canceled removed' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:14 title 'canceled total' smooth sbezier with lines lw 4 axis x1y2,\ - "instrumentation_transfers.log.$1" using 1:15 title 'choked added' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:16 title 'choked moved' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:17 title 'choked removed' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:18 title 'choked total' smooth sbezier with lines lw 4 axis x1y2 + "instrumentation_transfers.log.$1" using 1:7 title 'queue added' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:8 title 'queue moved' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:9 title 'queue removed' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:10 title 'queue total' smooth sbezier with lines lw 4 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:11 title 'unordered added' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:12 title 'unordered moved' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:13 title 'unordered removed' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:14 title 'unordered total' smooth sbezier with lines lw 4 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:15 title 'stalled added' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:16 title 'stalled moved' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:17 title 'stalled removed' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:18 title 'stalled total' smooth sbezier with lines lw 4 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:19 title 'choked added' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:20 title 'choked moved' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:21 title 'choked removed' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:22 title 'choked total' smooth sbezier with lines lw 4 axis x1y2 EOF From 38f39bdb23d206c86f1084d07e5cf04059ddc5d3 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Thu, 10 Apr 2014 22:32:07 +0900 Subject: [PATCH 21/24] Added unordered curve to plot. --- doc/plot/instrumentation_transfers.sh | 33 ++++++++++++++------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/doc/plot/instrumentation_transfers.sh b/doc/plot/instrumentation_transfers.sh index 4141a7bb..dde74876 100755 --- a/doc/plot/instrumentation_transfers.sh +++ b/doc/plot/instrumentation_transfers.sh @@ -23,25 +23,26 @@ plot \ "instrumentation_transfers.log.$1" using 1:4 title 'finished' smooth sbezier with lines lw 4 axis x1y1,\ "instrumentation_transfers.log.$1" using 1:5 title 'skipped' smooth sbezier with lines lw 2 axis x1y2,\ "instrumentation_transfers.log.$1" using 1:6 title 'unknown' smooth sbezier with lines lw 2 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:7 title 'unordered' smooth sbezier with lines lw 2 axis x1y2,\ "instrumentation_transfers.log.$1" using 1:19 title 'unaccounted' smooth sbezier with lines lw 2 axis x1y2 set output "output_$1_transfer_queues.png" plot \ - "instrumentation_transfers.log.$1" using 1:7 title 'queue added' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:8 title 'queue moved' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:9 title 'queue removed' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:10 title 'queue total' smooth sbezier with lines lw 4 axis x1y2,\ - "instrumentation_transfers.log.$1" using 1:11 title 'unordered added' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:12 title 'unordered moved' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:13 title 'unordered removed' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:14 title 'unordered total' smooth sbezier with lines lw 4 axis x1y2,\ - "instrumentation_transfers.log.$1" using 1:15 title 'stalled added' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:16 title 'stalled moved' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:17 title 'stalled removed' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:18 title 'stalled total' smooth sbezier with lines lw 4 axis x1y2,\ - "instrumentation_transfers.log.$1" using 1:19 title 'choked added' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:20 title 'choked moved' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:21 title 'choked removed' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:22 title 'choked total' smooth sbezier with lines lw 4 axis x1y2 + "instrumentation_transfers.log.$1" using 1:8 title 'queue added' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:9 title 'queue moved' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:10 title 'queue removed' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:11 title 'queue total' smooth sbezier with lines lw 4 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:12 title 'unordered added' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:13 title 'unordered moved' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:14 title 'unordered removed' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:15 title 'unordered total' smooth sbezier with lines lw 4 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:16 title 'stalled added' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:17 title 'stalled moved' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:18 title 'stalled removed' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:19 title 'stalled total' smooth sbezier with lines lw 4 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:20 title 'choked added' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:21 title 'choked moved' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:22 title 'choked removed' smooth sbezier with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:23 title 'choked total' smooth sbezier with lines lw 4 axis x1y2 EOF From d9f6f5aef42ff154f95dd65e3a35cd55453b2f3a Mon Sep 17 00:00:00 2001 From: rakshasa Date: Fri, 18 Apr 2014 22:16:24 +0900 Subject: [PATCH 22/24] Cleaned up CurlStack. --- src/core/curl_stack.cc | 53 +++++++++++++++++++++++++++++++----------- src/core/curl_stack.h | 2 ++ 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/src/core/curl_stack.cc b/src/core/curl_stack.cc index f0e6e8ec..a5e0e499 100644 --- a/src/core/curl_stack.cc +++ b/src/core/curl_stack.cc @@ -86,34 +86,44 @@ CurlStack::new_socket(int fd) { void CurlStack::receive_action(CurlSocket* socket, int events) { + if (this <= (CurlStack*)0x100) + throw torrent::internal_error("CurlStack::receive_action(...) called with shit == NULL"); + + if (this >= (CurlStack*)0x00007fff00000000) + throw torrent::internal_error("CurlStack::receive_action(...) called with this == 0x00007fff00000002"); + + if (socket != NULL && socket <= (CurlSocket*)0x100) + throw torrent::internal_error("CurlStack::receive_action(...) called with socket == NULL"); + + if (socket >= (CurlSocket*)0x00007fff00000000) + throw torrent::internal_error("CurlStack::receive_action(...) called with socket == 0x00007fff00000002"); + CURLMcode code; do { int count; #if (LIBCURL_VERSION_NUM >= 0x071003) - code = curl_multi_socket_action((CURLM*)m_handle, socket != NULL ? socket->file_descriptor() : CURL_SOCKET_TIMEOUT, events, &count); + code = curl_multi_socket_action((CURLM*)m_handle, + socket != NULL ? socket->file_descriptor() : CURL_SOCKET_TIMEOUT, + events, + &count); #else - code = curl_multi_socket((CURLM*)m_handle, socket != NULL ? socket->file_descriptor() : CURL_SOCKET_TIMEOUT, &count); + code = curl_multi_socket((CURLM*)m_handle, + socket != NULL ? socket->file_descriptor() : CURL_SOCKET_TIMEOUT, + &count); #endif if (code > 0) throw torrent::internal_error("Error calling curl_multi_socket_action."); - // Socket might be removed when cleaning handles below, future calls should not use it. + // Socket might be removed when cleaning handles below, future + // calls should not use it. socket = NULL; events = 0; if ((unsigned int)count != size()) { - // Done with some handles. - int t; - CURLMsg* msg; - - while ((msg = curl_multi_info_read((CURLM*)m_handle, &t)) != NULL) { - if (msg->msg != CURLMSG_DONE) - throw torrent::internal_error("CurlStack::receive_action() msg->msg != CURLMSG_DONE."); - - transfer_done(msg->easy_handle, msg->data.result == CURLE_OK ? NULL : curl_easy_strerror(msg->data.result)); - } + while (process_done_handle()) + ; // Do nothing. if (empty()) priority_queue_erase(&taskScheduler, &m_taskTimeout); @@ -122,6 +132,23 @@ CurlStack::receive_action(CurlSocket* socket, int events) { } while (code == CURLM_CALL_MULTI_PERFORM); } +bool +CurlStack::process_done_handle() { + int remaining_msgs = 0; + CURLMsg* msg = curl_multi_info_read((CURLM*)m_handle, &remaining_msgs); + + if (msg == NULL) + return false; + + if (msg->msg != CURLMSG_DONE) + throw torrent::internal_error("CurlStack::receive_action() msg->msg != CURLMSG_DONE."); + + transfer_done(msg->easy_handle, + msg->data.result == CURLE_OK ? NULL : curl_easy_strerror(msg->data.result)); + + return remaining_msgs != 0; +} + void CurlStack::transfer_done(void* handle, const char* msg) { iterator itr = std::find_if(begin(), end(), rak::equal(handle, std::mem_fun(&CurlGet::handle))); diff --git a/src/core/curl_stack.h b/src/core/curl_stack.h index d17f825c..3b8b341b 100644 --- a/src/core/curl_stack.h +++ b/src/core/curl_stack.h @@ -125,6 +125,8 @@ class CurlStack : std::deque { void receive_timeout(); + bool process_done_handle(); + void* m_handle; unsigned int m_active; From 82a68420f4d90098e00cc92f082f10a8079e9800 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Fri, 18 Apr 2014 22:27:13 +0900 Subject: [PATCH 23/24] Fixed non-POSIX conformant included headers. --- src/display/canvas.cc | 2 +- src/input/path_input.cc | 13 ++----------- src/signal_handler.h | 2 +- src/utils/directory.cc | 6 ++---- 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/display/canvas.cc b/src/display/canvas.cc index 4394b894..31db4ad4 100644 --- a/src/display/canvas.cc +++ b/src/display/canvas.cc @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include "canvas.h" diff --git a/src/input/path_input.cc b/src/input/path_input.cc index 461d850f..fa8afdaa 100644 --- a/src/input/path_input.cc +++ b/src/input/path_input.cc @@ -41,16 +41,11 @@ #include #include +#include +#include #include #include -#ifdef __sun__ - #include - #include -#else - #include -#endif - #include "path_input.h" namespace input { @@ -80,11 +75,7 @@ PathInput::pressed(int key) { struct _transform_filename { void operator () (utils::directory_entry& entry) { -#ifdef __sun__ - if (entry.d_type & S_IFDIR) -#else if (entry.d_type == DT_DIR) -#endif entry.d_name += '/'; } }; diff --git a/src/signal_handler.h b/src/signal_handler.h index a6aba468..f34c2810 100644 --- a/src/signal_handler.h +++ b/src/signal_handler.h @@ -37,7 +37,7 @@ #ifndef RTORRENT_SIGNAL_HANDLER_H #define RTORRENT_SIGNAL_HANDLER_H -#include +#include #include class SignalHandler { diff --git a/src/utils/directory.cc b/src/utils/directory.cc index f72d0f28..f934aeb8 100644 --- a/src/utils/directory.cc +++ b/src/utils/directory.cc @@ -38,14 +38,12 @@ #include #include + #include +#include #include #include -#ifdef __sun__ -#include -#endif - #include "directory.h" namespace utils { From ce125b1c54f31117f64a189851538920caaf16fe Mon Sep 17 00:00:00 2001 From: rakshasa Date: Mon, 21 Apr 2014 22:33:47 +0900 Subject: [PATCH 24/24] Updated instrumentation plot. --- doc/plot/instrumentation_transfers.sh | 49 ++++++++++++++------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/doc/plot/instrumentation_transfers.sh b/doc/plot/instrumentation_transfers.sh index dde74876..297d8b90 100755 --- a/doc/plot/instrumentation_transfers.sh +++ b/doc/plot/instrumentation_transfers.sh @@ -9,40 +9,41 @@ set y2tics set autoscale xfix set key autotitle columnhead -set datafile missing '0' +# set datafile missing '0' set format y "%.0f" set format y2 "%.0f" +set yrange [0:] set y2range [0:] set output "output_$1_transfer_requests.png" plot \ - "instrumentation_transfers.log.$1" using 1:2 title 'delegated' smooth sbezier with lines lw 4 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:3 title 'downloading' smooth sbezier with lines lw 4 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:4 title 'finished' smooth sbezier with lines lw 4 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:5 title 'skipped' smooth sbezier with lines lw 2 axis x1y2,\ - "instrumentation_transfers.log.$1" using 1:6 title 'unknown' smooth sbezier with lines lw 2 axis x1y2,\ - "instrumentation_transfers.log.$1" using 1:7 title 'unordered' smooth sbezier with lines lw 2 axis x1y2,\ - "instrumentation_transfers.log.$1" using 1:19 title 'unaccounted' smooth sbezier with lines lw 2 axis x1y2 + "instrumentation_transfers.log.$1" using 1:2 title 'delegated' with lines lw 4 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:3 title 'downloading' with lines lw 4 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:4 title 'finished' with lines lw 4 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:5 title 'skipped' with lines lw 2 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:6 title 'unknown' with lines lw 2 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:7 title 'unordered' with lines lw 2 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:19 title 'unaccounted' with lines lw 2 axis x1y2 set output "output_$1_transfer_queues.png" plot \ - "instrumentation_transfers.log.$1" using 1:8 title 'queue added' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:9 title 'queue moved' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:10 title 'queue removed' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:11 title 'queue total' smooth sbezier with lines lw 4 axis x1y2,\ - "instrumentation_transfers.log.$1" using 1:12 title 'unordered added' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:13 title 'unordered moved' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:14 title 'unordered removed' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:15 title 'unordered total' smooth sbezier with lines lw 4 axis x1y2,\ - "instrumentation_transfers.log.$1" using 1:16 title 'stalled added' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:17 title 'stalled moved' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:18 title 'stalled removed' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:19 title 'stalled total' smooth sbezier with lines lw 4 axis x1y2,\ - "instrumentation_transfers.log.$1" using 1:20 title 'choked added' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:21 title 'choked moved' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:22 title 'choked removed' smooth sbezier with lines lw 2 axis x1y1,\ - "instrumentation_transfers.log.$1" using 1:23 title 'choked total' smooth sbezier with lines lw 4 axis x1y2 + "instrumentation_transfers.log.$1" using 1:8 title 'queue added' with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:9 title 'queue moved' with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:10 title 'queue removed' with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:11 title 'queue total' with lines lw 4 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:12 title 'unordered added' with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:13 title 'unordered moved' with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:14 title 'unordered removed' with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:15 title 'unordered total' with lines lw 4 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:16 title 'stalled added' with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:17 title 'stalled moved' with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:18 title 'stalled removed' with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:19 title 'stalled total' with lines lw 4 axis x1y2,\ + "instrumentation_transfers.log.$1" using 1:20 title 'choked added' with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:21 title 'choked moved' with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:22 title 'choked removed' with lines lw 2 axis x1y1,\ + "instrumentation_transfers.log.$1" using 1:23 title 'choked total' with lines lw 4 axis x1y2 EOF