Merge branch 'master' into pr/190

This commit is contained in:
rakshasa
2014-06-12 21:43:31 +09:00
15 changed files with 1270 additions and 80 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
AC_INIT(rtorrent, 0.9.3, sundell.software@gmail.com)
AC_INIT(rtorrent, 0.9.4, sundell.software@gmail.com)
AC_DEFINE(API_VERSION, 8, api version)
@@ -45,7 +45,7 @@ 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.4,
CXXFLAGS="$CXXFLAGS $libtorrent_CFLAGS";
LIBS="$LIBS $libtorrent_LIBS")
+25 -24
View File
@@ -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
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -438,7 +438,7 @@ cmd_catch(rpc::target_type target, const torrent::Object& args) {
void
initialize_command_dynamic() {
CMD2_VAR_BOOL ("method.use_deprecated", true);
CMD2_VAR_BOOL ("method.use_deprecated", false);
CMD2_VAR_VALUE ("method.use_intermediate", 1);
CMD2_ANY_LIST ("method.insert", tr1::bind(&system_method_insert, tr1::placeholders::_2));
+5 -3
View File
@@ -140,7 +140,7 @@ initialize_xmlrpc() {
rpc::xmlrpc.insert_command(itr->first, itr->second.m_parm, itr->second.m_doc);
}
lt_log_print(torrent::LOG_RPC_INFO, "XMLRPC initialized with %u functions.", count);
lt_log_print(torrent::LOG_RPC_EVENTS, "XMLRPC initialized with %u functions.", count);
}
torrent::Object
@@ -169,7 +169,8 @@ apply_scgi(const std::string& arg, int type) {
sa.sa_inet()->clear();
saPtr = &sa;
lt_log_print(torrent::LOG_RPC_WARN, "The SCGI socket has not been bound to any address and likely poses a security risk.");
lt_log_print(torrent::LOG_RPC_EVENTS,
"The SCGI socket has not been bound to any address and likely poses a security risk.");
} else if (std::sscanf(arg.c_str(), "%1023[^:]:%i%c", address, &port, &dummy) == 2) {
if ((err = rak::address_info::get_address_info(address, PF_INET, SOCK_STREAM, &ai)) != 0)
@@ -177,7 +178,8 @@ apply_scgi(const std::string& arg, int type) {
saPtr = ai->address();
lt_log_print(torrent::LOG_RPC_WARN, "The SCGI socket is bound to a specific network device yet may still pose a security risk, consider using 'scgi_local'.");
lt_log_print(torrent::LOG_RPC_EVENTS,
"The SCGI socket is bound to a specific network device yet may still pose a security risk, consider using 'scgi_local'.");
} else {
throw torrent::input_error("Could not parse address.");
+28 -13
View File
@@ -92,29 +92,27 @@ CurlStack::receive_action(CurlSocket* socket, int events) {
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);
@@ -123,6 +121,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)));
+2
View File
@@ -128,6 +128,8 @@ class CurlStack : std::deque<CurlGet*> {
void receive_timeout();
bool process_done_handle();
void* m_handle;
unsigned int m_active;
+1 -1
View File
@@ -38,7 +38,7 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/termios.h>
#include <termios.h>
#include <torrent/exceptions.h>
#include "canvas.h"
+2 -11
View File
@@ -41,16 +41,11 @@
#include <rak/functional.h>
#include <rak/path.h>
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <torrent/utils/log.h>
#ifdef __sun__
#include <dirent.h>
#include <sys/stat.h>
#else
#include <sys/dir.h>
#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 += '/';
}
};
+17 -16
View File
@@ -230,7 +230,7 @@ main(int argc, char** argv) {
initialize_commands();
if (OptionParser::has_flag('D', argc, argv)) {
rpc::call_command_set_value("method.use_deprecated.set", false);
rpc::call_command_set_value("method.use_deprecated.set", true);
lt_log_print(torrent::LOG_WARN, "Disabled deprecated commands.");
}
@@ -394,11 +394,26 @@ main(int argc, char** argv) {
CMD2_REDIRECT ("port_random", "network.port_random.set");
CMD2_REDIRECT ("proxy_address", "network.proxy_address.set");
CMD2_REDIRECT ("scgi_port", "network.scgi.open_port");
CMD2_REDIRECT ("scgi_local", "network.scgi.open_local");
CMD2_REDIRECT_GENERIC("directory", "directory.default.set");
CMD2_REDIRECT_GENERIC("session", "session.path.set");
CMD2_REDIRECT ("check_hash", "pieces.hash.on_completion.set");
CMD2_REDIRECT ("key_layout", "keys.layout.set");
CMD2_REDIRECT_GENERIC("to_gm_time", "convert.gm_time");
CMD2_REDIRECT_GENERIC("to_gm_date", "convert.gm_date");
CMD2_REDIRECT_GENERIC("to_time", "convert.time");
CMD2_REDIRECT_GENERIC("to_date", "convert.date");
CMD2_REDIRECT_GENERIC("to_elapsed_time", "convert.elapsed_time");
CMD2_REDIRECT_GENERIC("to_kb", "convert.kb");
CMD2_REDIRECT_GENERIC("to_mb", "convert.mb");
CMD2_REDIRECT_GENERIC("to_xb", "convert.xb");
CMD2_REDIRECT_GENERIC("to_throttle", "convert.throttle");
// Deprecated commands. Don't use these anymore.
if (rpc::call_command_value("method.use_intermediate") == 1) {
@@ -556,10 +571,6 @@ main(int argc, char** argv) {
CMD2_REDIRECT_GENERIC("set_proxy_address", "network.proxy_address.set");
CMD2_REDIRECT ("get_proxy_address", "network.proxy_address");
CMD2_REDIRECT ("scgi_port", "network.scgi.open_port");
CMD2_REDIRECT ("scgi_local", "network.scgi.open_local");
CMD2_REDIRECT ("scgi_dont_route", "network.scgi.dont_route.set");
CMD2_REDIRECT_GENERIC("set_scgi_dont_route", "network.scgi.dont_route.set");
CMD2_REDIRECT ("get_scgi_dont_route", "network.scgi.dont_route");
@@ -634,7 +645,6 @@ main(int argc, char** argv) {
CMD2_REDIRECT ("get_session_on_completion", "session.on_completion");
CMD2_REDIRECT_GENERIC("set_session_on_completion", "session.on_completion.set");
CMD2_REDIRECT ("check_hash", "pieces.hash.on_completion.set");
CMD2_REDIRECT ("get_check_hash", "pieces.hash.on_completion");
CMD2_REDIRECT_GENERIC("set_check_hash", "pieces.hash.on_completion.set");
@@ -809,16 +819,6 @@ main(int argc, char** argv) {
// Rename these to avoid conflicts with old style.
CMD2_REDIRECT_GENERIC("d.multicall", "d.multicall2");
CMD2_REDIRECT_GENERIC("to_gm_time", "convert.gm_time");
CMD2_REDIRECT_GENERIC("to_gm_date", "convert.gm_date");
CMD2_REDIRECT_GENERIC("to_time", "convert.time");
CMD2_REDIRECT_GENERIC("to_date", "convert.date");
CMD2_REDIRECT_GENERIC("to_elapsed_time", "convert.elapsed_time");
CMD2_REDIRECT_GENERIC("to_kb", "convert.kb");
CMD2_REDIRECT_GENERIC("to_mb", "convert.mb");
CMD2_REDIRECT_GENERIC("to_xb", "convert.xb");
CMD2_REDIRECT_GENERIC("to_throttle", "convert.throttle");
CMD2_REDIRECT_GENERIC("execute_throw", "execute.throw");
CMD2_REDIRECT_GENERIC("execute_nothrow", "execute.nothrow");
CMD2_REDIRECT_GENERIC("execute_raw", "execute.raw");
@@ -1002,6 +1002,7 @@ print_help() {
std::cout << "order. Use the up/down/left/right arrow keys to move between screens." << std::endl;
std::cout << std::endl;
std::cout << "Usage: rtorrent [OPTIONS]... [FILE]... [URL]..." << std::endl;
std::cout << " -D Enable deprecated commands" << std::endl;
std::cout << " -h Display this very helpful text" << std::endl;
std::cout << " -n Don't try to load ~/.rtorrent.rc on startup" << std::endl;
std::cout << " -b <a.b.c.d> Bind the listening socket to this IP" << std::endl;
+1 -1
View File
@@ -53,7 +53,7 @@ class lt_cacheline_aligned SCgi : public torrent::Event {
public:
typedef rak::function2<bool, const char*, uint32_t> slot_write;
static const int max_tasks = 30;
static const int max_tasks = 100;
// Global lock:
SCgi() : m_logFd(-1) {}
+2 -2
View File
@@ -185,7 +185,7 @@ SCgiTask::event_read() {
result = write(m_parent->log_fd(), "\n---\n", sizeof("\n---\n"));
}
lt_log_print_dump(torrent::LOG_RPC_DEBUG, m_body, m_bufferSize - std::distance(m_buffer, m_body), "scgi", "RPC read.", 0);
lt_log_print_dump(torrent::LOG_RPC_DUMP, m_body, m_bufferSize - std::distance(m_buffer, m_body), "scgi", "RPC read.", 0);
// Close if the call failed, else stay open to write back data.
if (!m_parent->receive_call(this, m_body, m_bufferSize - std::distance(m_buffer, m_body)))
@@ -246,7 +246,7 @@ SCgiTask::receive_write(const char* buffer, uint32_t length) {
result = write(m_parent->log_fd(), "\n---\n", sizeof("\n---\n"));
}
lt_log_print_dump(torrent::LOG_RPC_DEBUG, m_buffer, m_bufferSize, "scgi", "RPC write.", 0);
lt_log_print_dump(torrent::LOG_RPC_DUMP, m_buffer, m_bufferSize, "scgi", "RPC write.", 0);
event_write();
return true;
+1 -1
View File
@@ -37,7 +37,7 @@
#ifndef RTORRENT_SIGNAL_HANDLER_H
#define RTORRENT_SIGNAL_HANDLER_H
#include <sys/signal.h>
#include <signal.h>
#include <tr1/functional>
class SignalHandler {
+1 -1
View File
@@ -53,7 +53,7 @@ public:
ThreadWorker();
~ThreadWorker();
const char* name() const { return "worker_rtorrent"; }
const char* name() const { return "rtorrent scgi"; }
virtual void init_thread();
+2 -4
View File
@@ -38,14 +38,12 @@
#include <algorithm>
#include <functional>
#include <dirent.h>
#include <sys/stat.h>
#include <rak/path.h>
#include <torrent/exceptions.h>
#ifdef __sun__
#include <sys/stat.h>
#endif
#include "directory.h"
namespace utils {