From c2b768cd6d1dee55dedb242b17ac2638bc0ea0b6 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Wed, 18 Apr 2012 16:55:30 +0900 Subject: [PATCH 1/4] Minor updates to choke group documentation. --- doc/manual/choke_groups.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/manual/choke_groups.md b/doc/manual/choke_groups.md index 7d627216..15d1390b 100644 --- a/doc/manual/choke_groups.md +++ b/doc/manual/choke_groups.md @@ -8,6 +8,9 @@ Create a new group named "leech_fast", accessible by the string or index / reverse index according to order of insertion. E.g. '-1' refers to the last inserted choke group, while 0 refers to the first. +All commands that applies to a group requires the first argument to be +the index, reverse index or the group name. + choke_group.tracker.mode.set = -1,"aggressive" Set the tracker mode for torrents in this group. From 03c0a4e18c9a5ade8b62863ad4e8664c5e148430 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Wed, 18 Apr 2012 17:32:12 +0900 Subject: [PATCH 2/4] Allow tilde for 'log.open_file' path. --- src/command_local.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/command_local.cc b/src/command_local.cc index c8ab52f0..d88b8c0a 100644 --- a/src/command_local.cc +++ b/src/command_local.cc @@ -304,7 +304,8 @@ apply_log_open_file(const torrent::Object::list_type& args) { if (args.size() != 2) throw torrent::input_error("Invalid number of arguments."); - torrent::log_open_file_output(args.front().as_string().c_str(), args.back().as_string().c_str()); + torrent::log_open_file_output(args.front().as_string().c_str(), + rak::path_expand(args.back().as_string()).c_str()); return torrent::Object(); } From 4dd7582240d3293f23dc73c2fc8c3de09c237578 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Fri, 20 Apr 2012 16:03:55 +0900 Subject: [PATCH 3/4] Bumped version to 0.9.2. --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 09dd25f1..b9aa8830 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(rtorrent, 0.9.1, jaris@ifi.uio.no) +AC_INIT(rtorrent, 0.9.2, jaris@ifi.uio.no) AC_DEFINE(API_VERSION, 6, api version) @@ -49,7 +49,7 @@ PKG_CHECK_MODULES(libcurl, libcurl >= 7.15.4, CXXFLAGS="$CXXFLAGS $libcurl_CFLAGS"; LIBS="$LIBS $libcurl_LIBS") -PKG_CHECK_MODULES(libtorrent, libtorrent >= 0.13.1, +PKG_CHECK_MODULES(libtorrent, libtorrent >= 0.13.2, CXXFLAGS="$CXXFLAGS $libtorrent_CFLAGS"; LIBS="$LIBS $libtorrent_LIBS") From cca1f21471c1f3818fc45d1f0f53a383ad2a2e02 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Wed, 25 Apr 2012 21:46:23 +0900 Subject: [PATCH 4/4] Added logging of segfault/bus signal and backtrace to LOG_CRITICAL. --- src/main.cc | 66 ++++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/src/main.cc b/src/main.cc index 796a96a2..25855daf 100644 --- a/src/main.cc +++ b/src/main.cc @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -899,7 +900,8 @@ handle_sigbus(int signum, siginfo_t* sa, void* ptr) { // Use printf here instead... - printf("Caught SIGBUS, dumping stack:\n"); + std::stringstream output; + output << "Caught SIGBUS, dumping stack:" << std::endl; #ifdef USE_EXECINFO void* stackPtrs[20]; @@ -909,13 +911,13 @@ handle_sigbus(int signum, siginfo_t* sa, void* ptr) { char** stackStrings = backtrace_symbols(stackPtrs, stackSize); for (int i = 0; i < stackSize; ++i) - printf("%i %s\n", i, stackStrings[i]); + output << stackStrings[i] << std::endl; #else - printf("Stack dump not enabled.\n"); + output << "Stack dump not enabled." << std::endl; #endif - printf("\nError: %s\n", rak::error_number(sa->si_errno).c_str()); + output << std::endl << "Error: " << rak::error_number(sa->si_errno).c_str() << std::endl; const char* signal_reason; @@ -932,23 +934,31 @@ handle_sigbus(int signum, siginfo_t* sa, void* ptr) { break; }; - printf("Signal code '%i': %s\n", sa->si_code, signal_reason); - printf("Fault address: %p.\n\n", sa->si_addr); + output << "Signal code '" << sa->si_code << "': " << signal_reason << std::endl; + output << "Fault address: " << sa->si_addr << std::endl; // New code for finding the location of the SIGBUS signal, and using // that to figure out how to recover. torrent::chunk_info_result result = torrent::chunk_list_address_info(sa->si_addr); if (!result.download.is_valid()) { - printf("The fault address is not part of any chunk.\n"); - std::abort(); + output << "The fault address is not part of any chunk." << std::endl; + goto handle_sigbus_exit; } - printf("Torrent name: '%s'.\n", result.download.info()->name().c_str()); - printf("File name: '%s'.\n", result.file_path); - printf("File offset: %" PRIu64 ".\n", result.file_offset); - printf("Chunk index: %u.\n", result.chunk_index); - printf("Chunk offset: %u.\n", result.chunk_offset); + output << "Torrent name: " << result.download.info()->name().c_str() << std::endl; + output << "File name: " << result.file_path << std::endl; + output << "File offset: " << result.file_offset << std::endl; + output << "Chunk index: " << result.chunk_index << std::endl; + output << "Chunk offset: " << result.chunk_offset << std::endl; + +handle_sigbus_exit: + std::cout << output.rdbuf(); + + if (lt_log_is_valid(torrent::LOG_CRITICAL)) { + std::string dump = output.str(); + lt_log_print_dump(torrent::LOG_CRITICAL, dump.c_str(), dump.size(), "Caught signal: '%s'.", signal_reason); + } torrent::log_cleanup(); std::abort(); @@ -961,9 +971,9 @@ do_panic(int signum) { SignalHandler::set_default(signum); display::Canvas::cleanup(); - // Use printf here instead... + std::stringstream output; - std::cout << "Caught " << SignalHandler::as_string(signum) << ", dumping stack:" << std::endl; + output << "Caught " << SignalHandler::as_string(signum) << ", dumping stack:" << std::endl; #ifdef USE_EXECINFO void* stackPtrs[20]; @@ -973,27 +983,21 @@ do_panic(int signum) { char** stackStrings = backtrace_symbols(stackPtrs, stackSize); for (int i = 0; i < stackSize; ++i) - std::cout << i << ' ' << stackStrings[i] << std::endl; + output << stackStrings[i] << std::endl; #else - std::cout << "Stack dump not enabled." << std::endl; + output << "Stack dump not enabled." << std::endl; #endif - // Dumping virtual memory map information to file: - // char dump_path[256]; - // snprintf(dump_path, 256, "./rtorrent.map.%u", getpid()); - - // int dump_fd = open(dump_path, O_RDWR | O_CREAT); - - // if (dump_fd == -1) { - // printf("Could not create vmmap dump file '%s'.", dump_path); - // goto do_panic_exit; - // } - -// do_panic_exit: - if (signum == SIGBUS) - std::cout << "A bus error probably means you ran out of diskspace." << std::endl; + output << "A bus error probably means you ran out of diskspace." << std::endl; + + std::cout << output.rdbuf(); + + if (lt_log_is_valid(torrent::LOG_CRITICAL)) { + std::string dump = output.str(); + lt_log_print_dump(torrent::LOG_CRITICAL, dump.c_str(), dump.size(), "Caught signal: '%s.", strsignal(signum)); + } torrent::log_cleanup(); std::abort();