Only in /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/: Makefile Only in /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/: config.h diff -rupa /usr/ports/net-p2p/rtorrent/work/rtorrent-0.8.6/config.h.in /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/config.h.in --- /usr/ports/net-p2p/rtorrent/work/rtorrent-0.8.6/config.h.in 2009-11-30 23:53:48.000000000 +0800 +++ /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/config.h.in 2010-05-04 02:28:11.000000000 +0900 @@ -72,6 +72,9 @@ /* Support for XMLRPC-C. */ #undef HAVE_XMLRPC_C +/* Support for NO_GUI. */ +#undef NO_GUI + /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR Only in /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/: config.h.in.orig Only in /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/: config.log Only in /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/: config.status diff -rupa /usr/ports/net-p2p/rtorrent/work/rtorrent-0.8.6/configure /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/configure --- /usr/ports/net-p2p/rtorrent/work/rtorrent-0.8.6/configure 2010-05-04 02:23:51.000000000 +0900 +++ /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/configure 2010-05-04 02:33:07.000000000 +0900 @@ -884,6 +884,8 @@ with_ncursesw with_statvfs with_statfs with_xmlrpc_c +with_no_gui + ' ac_precious_vars='build_alias host_alias @@ -1550,6 +1552,7 @@ Optional Packages: --without-statvfs Don't try to use statvfs to find free diskspace. --without-statfs Don't try to use statfs to find free diskspace. --with-xmlrpc-c=PATH Enable XMLRPC-C support. + --with-no-gui Disable GUI. Some influential environment variables: CXX C++ compiler command @@ -15806,6 +15809,19 @@ ac_link='$CXX -o conftest$ac_exeext $CXX ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + { $as_echo "$as_me:$LINENO: No GUI support configured" >&5 +$as_echo_n "No GUI support configured... " >&6; } + +# Check whether --with-no-gui was given. +if test "${with_no_gui+set}" = set; then +cat >>confdefs.h <<\_ACEOF +#define NO_GUI 1 +_ACEOF +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XMLRPC-C" >&5 $as_echo_n "checking for XMLRPC-C... " >&6; } Only in /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/doc: Makefile Only in /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/: libtool Only in /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/src: Makefile diff -rupa /usr/ports/net-p2p/rtorrent/work/rtorrent-0.8.6/src/command_network.cc /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/src/command_network.cc --- /usr/ports/net-p2p/rtorrent/work/rtorrent-0.8.6/src/command_network.cc 2009-11-12 16:19:40.000000000 +0800 +++ /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/src/command_network.cc 2010-05-04 01:51:02.000000000 +0900 @@ -52,7 +52,9 @@ #include "core/download.h" #include "core/manager.h" #include "rpc/scgi.h" +#ifndef NO_GUI #include "ui/root.h" +#endif #include "rpc/command_slot.h" #include "rpc/command_variable.h" #include "rpc/parse.h" @@ -404,6 +406,75 @@ apply_xmlrpc_dialect(const std::string& rpc::xmlrpc.set_dialect(value); } + +#ifdef NO_GUI +void set_down_throttle(unsigned int throttle); +void set_up_throttle(unsigned int throttle); +void set_down_throttle_i64(int64_t throttle) { set_down_throttle(throttle >> 10); } +void set_up_throttle_i64(int64_t throttle) { set_up_throttle(throttle >> 10); } + +void +set_down_throttle(unsigned int throttle) { + + torrent::down_throttle_global()->set_max_rate(throttle * 1024); + + unsigned int div = std::max(rpc::call_command_value("get_max_downloads_div"), 0); + unsigned int global = std::max(rpc::call_command_value("get_max_downloads_global"), 0); + + if (throttle == 0 || div == 0) { + torrent::set_max_download_unchoked(global); + return; + } + + throttle /= div; + + unsigned int maxUnchoked; + + if (throttle <= 10) + maxUnchoked = 1 + throttle / 1; + else + maxUnchoked = 10 + throttle / 5; + + if (global != 0) + torrent::set_max_download_unchoked(std::min(maxUnchoked, global)); + else + torrent::set_max_download_unchoked(maxUnchoked); +} + +void +set_up_throttle(unsigned int throttle) { + + torrent::up_throttle_global()->set_max_rate(throttle * 1024); + + unsigned int div = std::max(rpc::call_command_value("get_max_uploads_div"), 0); + unsigned int global = std::max(rpc::call_command_value("get_max_uploads_global"), 0); + + if (throttle == 0 || div == 0) { + torrent::set_max_unchoked(global); + return; + } + + throttle /= div; + + unsigned int maxUnchoked; + + if (throttle <= 10) + maxUnchoked = 1 + throttle / 1; + else + maxUnchoked = 10 + throttle / 5; + + if (global != 0) + torrent::set_max_unchoked(std::min(maxUnchoked, global)); + else + torrent::set_max_unchoked(maxUnchoked); +} +#endif + + + + + + void initialize_command_network() { torrent::ConnectionManager* cm = torrent::connection_manager(); @@ -434,8 +505,13 @@ initialize_command_network() { // ADD_COMMAND_VALUE_TRI("max_uploads_global", rak::make_mem_fun(control->ui(), &ui::Root::set_max_uploads_global), rak::make_mem_fun(control->ui(), &ui::Root::max_uploads_global)); // ADD_COMMAND_VALUE_TRI("max_downloads_global", rak::make_mem_fun(control->ui(), &ui::Root::set_max_downloads_global), rak::make_mem_fun(control->ui(), &ui::Root::max_downloads_global)); +#ifndef NO_GUI ADD_COMMAND_VALUE_TRI_KB("download_rate", rak::make_mem_fun(control->ui(), &ui::Root::set_down_throttle_i64), rak::make_mem_fun(torrent::down_throttle_global(), &torrent::Throttle::max_rate)); ADD_COMMAND_VALUE_TRI_KB("upload_rate", rak::make_mem_fun(control->ui(), &ui::Root::set_up_throttle_i64), rak::make_mem_fun(torrent::up_throttle_global(), &torrent::Throttle::max_rate)); +#else + ADD_COMMAND_VALUE_TRI_KB("download_rate", std::ptr_fun(&set_down_throttle_i64), rak::make_mem_fun(torrent::down_throttle_global(), &torrent::Throttle::max_rate)); + ADD_COMMAND_VALUE_TRI_KB("upload_rate", std::ptr_fun(&set_up_throttle_i64), rak::make_mem_fun(torrent::up_throttle_global(), &torrent::Throttle::max_rate)); +#endif ADD_COMMAND_VOID("get_up_rate", rak::make_mem_fun(torrent::up_rate(), &torrent::Rate::rate)); ADD_COMMAND_VOID("get_up_total", rak::make_mem_fun(torrent::up_rate(), &torrent::Rate::total)); diff -rupa /usr/ports/net-p2p/rtorrent/work/rtorrent-0.8.6/src/command_peer.cc /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/src/command_peer.cc --- /usr/ports/net-p2p/rtorrent/work/rtorrent-0.8.6/src/command_peer.cc 2009-11-12 16:03:48.000000000 +0800 +++ /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/src/command_peer.cc 2010-05-04 01:52:35.000000000 +0900 @@ -46,7 +46,7 @@ #include #include "core/manager.h" -#include "display/utils.h" +//#include "display/utils.h" #include "globals.h" #include "control.h" @@ -78,9 +78,21 @@ retrieve_p_port(torrent::Peer* peer) { torrent::Object retrieve_p_client_version(torrent::Peer* peer) { - char buf[128]; - display::print_client_version(buf, buf + 128, peer->peer_info()->client_info()); + char buf[128]={0}; + ////display::print_client_version(buf, buf + 128, peer->peer_info()->client_info()); + torrent::ClientInfo clientInfo=peer->peer_info()->client_info(); + switch (torrent::ClientInfo::version_size(clientInfo.type())){ + case 4: + snprintf(buf,sizeof(buf),"%s %hhu.%hhu.%hhu.%hhu",clientInfo.short_description(),clientInfo.version()[0],clientInfo.version()[1],clientInfo.version()[2],clientInfo.version()[3]); + break; + case 3: + snprintf(buf,sizeof(buf),"%s %hhu.%hhu.%hhu",clientInfo.short_description(),clientInfo.version()[0],clientInfo.version()[1],clientInfo.version()[2]); + break; + default: + snprintf(buf,sizeof(buf),"%s",clientInfo.short_description()); + break; + } return std::string(buf); } diff -rupa /usr/ports/net-p2p/rtorrent/work/rtorrent-0.8.6/src/command_ui.cc /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/src/command_ui.cc --- /usr/ports/net-p2p/rtorrent/work/rtorrent-0.8.6/src/command_ui.cc 2009-11-12 16:03:48.000000000 +0800 +++ /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/src/command_ui.cc 2010-05-04 02:38:49.000000000 +0900 @@ -43,8 +43,10 @@ #include "core/manager.h" #include "core/view_manager.h" +#ifndef NO_GUI #include "ui/root.h" #include "ui/download_list.h" +#endif #include "rpc/command_slot.h" #include "rpc/command_variable.h" #include "rpc/parse.h" @@ -424,14 +426,19 @@ cmd_view_persistent(__UNUSED rpc::target torrent::Object cmd_ui_set_view(__UNUSED rpc::target_type target, const torrent::Object& rawArgs) { +#ifndef NO_GUI control->ui()->download_list()->set_current_view(rawArgs.as_string()); +#endif return torrent::Object(); } torrent::Object cmd_ui_unfocus_download(core::Download* download, const torrent::Object& rawArgs) { + +#ifndef NO_GUI control->ui()->download_list()->unfocus_download(download); +#endif return torrent::Object(); } diff -rupa /usr/ports/net-p2p/rtorrent/work/rtorrent-0.8.6/src/control.cc /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/src/control.cc --- /usr/ports/net-p2p/rtorrent/work/rtorrent-0.8.6/src/control.cc 2009-11-12 16:19:40.000000000 +0800 +++ /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/src/control.cc 2010-05-04 02:39:50.000000000 +0900 @@ -45,15 +45,19 @@ #include "core/view_manager.h" #include "core/dht_manager.h" +#ifndef NO_GUI #include "display/canvas.h" #include "display/window.h" #include "display/manager.h" #include "input/manager.h" #include "input/input_event.h" +#endif #include "rpc/command_scheduler.h" #include "rpc/parse_commands.h" #include "rpc/scgi.h" +#ifndef NO_GUI #include "ui/root.h" +#endif #include "control.h" @@ -61,10 +65,12 @@ Control::Control() : m_shutdownReceived(false), m_shutdownQuick(false), +#ifndef NO_GUI m_ui(new ui::Root()), m_display(new display::Manager()), m_input(new input::Manager()), m_inputStdin(new input::InputEvent(STDIN_FILENO)), +#endif m_commandScheduler(new rpc::CommandScheduler()), @@ -76,7 +82,9 @@ Control::Control() : m_viewManager = new core::ViewManager(); m_dhtManager = new core::DhtManager(); +#ifndef NO_GUI m_inputStdin->slot_pressed(sigc::mem_fun(m_input, &input::Manager::pressed)); +#endif m_taskShutdown.set_slot(rak::mem_fn(this, &Control::handle_shutdown)); @@ -84,25 +92,32 @@ Control::Control() : } Control::~Control() { +#ifndef NO_GUI delete m_inputStdin; delete m_input; +#endif delete m_commandScheduler; delete m_viewManager; +#ifndef NO_GUI delete m_ui; delete m_display; +#endif + delete m_core; delete m_dhtManager; } void Control::initialize() { +#ifndef NO_GUI display::Canvas::initialize(); display::Window::slot_schedule(rak::make_mem_fun(m_display, &display::Manager::schedule)); display::Window::slot_unschedule(rak::make_mem_fun(m_display, &display::Manager::unschedule)); display::Window::slot_adjust(rak::make_mem_fun(m_display, &display::Manager::adjust_layout)); +#endif m_core->http_stack()->set_user_agent(USER_AGENT); @@ -112,9 +127,11 @@ Control::initialize() { m_core->set_hashing_view(*m_viewManager->find_throw("hashing")); +#ifndef NO_GUI m_ui->init(this); m_inputStdin->insert(this_thread->poll()); +#endif } void @@ -124,24 +141,32 @@ Control::cleanup() { priority_queue_erase(&taskScheduler, &m_taskShutdown); +#ifndef NO_GUI m_inputStdin->remove(this_thread->poll()); +#endif m_core->download_store()->disable(); +#ifndef NO_GUI m_ui->cleanup(); +#endif m_core->cleanup(); +#ifndef NO_GUI display::Canvas::erase_std(); display::Canvas::refresh_std(); display::Canvas::do_update(); display::Canvas::cleanup(); +#endif } void Control::cleanup_exception() { delete m_scgi; m_scgi = NULL; +#ifndef NO_GUI display::Canvas::cleanup(); +#endif } void Only in /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/src/core: Makefile Only in /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/src/display: Makefile Only in /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/src/input: Makefile diff -rupa /usr/ports/net-p2p/rtorrent/work/rtorrent-0.8.6/src/main.cc /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/src/main.cc --- /usr/ports/net-p2p/rtorrent/work/rtorrent-0.8.6/src/main.cc 2009-11-14 15:35:44.000000000 +0800 +++ /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/src/main.cc 2010-05-04 02:04:10.000000000 +0900 @@ -54,10 +54,12 @@ #include "core/download_factory.h" #include "core/download_store.h" #include "core/manager.h" +#ifndef NO_GUI #include "display/canvas.h" #include "display/window.h" #include "display/manager.h" #include "input/bindings.h" +#endif #include "rpc/command_scheduler.h" #include "rpc/command_scheduler_item.h" @@ -163,7 +165,9 @@ main(int argc, char** argv) { SignalHandler::set_ignore(SIGPIPE); SignalHandler::set_handler(SIGINT, sigc::mem_fun(control, &Control::receive_normal_shutdown)); SignalHandler::set_handler(SIGTERM, sigc::mem_fun(control, &Control::receive_quick_shutdown)); +#ifndef NO_GUI SignalHandler::set_handler(SIGWINCH, sigc::mem_fun(control->display(), &display::Manager::force_redraw)); +#endif SignalHandler::set_handler(SIGSEGV, sigc::bind(sigc::ptr_fun(&do_panic), SIGSEGV)); SignalHandler::set_handler(SIGBUS, sigc::bind(sigc::ptr_fun(&do_panic), SIGBUS)); SignalHandler::set_handler(SIGFPE, sigc::bind(sigc::ptr_fun(&do_panic), SIGFPE)); @@ -305,8 +309,10 @@ main(int argc, char** argv) { // Make sure we update the display before any scheduled tasks can // run, so that loading of torrents doesn't look like it hangs on // startup. +#ifndef NO_GUI control->display()->adjust_layout(); control->display()->receive_update(); +#endif while (!control->is_shutdown_completed()) { if (control->is_shutdown_received()) @@ -342,7 +348,9 @@ do_panic(int signum) { // Use the default signal handler in the future to avoid infinit // loops. SignalHandler::set_default(signum); +#ifndef NO_GUI display::Canvas::cleanup(); +#endif std::cout << "Caught " << SignalHandler::as_string(signum) << ", dumping stack:" << std::endl; Only in /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/src/rpc: Makefile Only in /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/src/ui: Makefile Only in /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/src/utils: Makefile Only in /usr/ports/net-p2p/rtorrent/rtorrent-0.8.6/: stamp-h1