diff --git a/doc/rtorrent.1.xml b/doc/rtorrent.1.xml index 186d7b21..b0550862 100644 --- a/doc/rtorrent.1.xml +++ b/doc/rtorrent.1.xml @@ -68,16 +68,12 @@ supporting B, K, M and G suffixes. - up | down + up | down | left | right arrow keys + ^P | ^N | ^B | ^F - Select item. - - - - - <- - - Go back to the previous screen. +Select entries or change windows. The right arrow key or ^F is often +used for viewing details about the selected entry, while the left +arrow key or ^B often returns to the previous screen. @@ -121,104 +117,94 @@ supporting B, K, M and G suffixes. -> - View download. +View download. 1 - 7 - Change view. - ^S - Start download. +Start download. ^D - Stop an active download, or remove a stopped download. - ^K - Close a torrent and its files. - ^R - Initiate hash check of torrent. +Initiate hash check of torrent. ^O - Change the destination directory of the download. The - torrent must be closed. +Change the destination directory of the download. The torrent must be +closed. + + + + + ^X + +Call commands or change settings. + | - - Change the priority of the download. +Change the priority of the download. backspace - Add torrent using an URL or file path. Use - tab to view directory content and do - auto-complete. +Add torrent using an URL or file path. Use +tab to view directory content and do +auto-complete. l - View log. Exit by pressing the space-bar. - - - - - ^P - - Call commands or change settings. +View log. Exit by pressing the space-bar. U - Delete the file the torrent is tied to, and clear the association. - I - Toggle whether torrent ignores ratio settings. - @@ -234,16 +220,15 @@ Toggle whether torrent ignores ratio settings. -> - View torrent file list. Use the space-bar to change the - file priority and * to change the - priority of all files. +View torrent file list. Use the space-bar to change the file priority +and * to change the priority of all files. 1 | 2 - Adjust max uploads. +Adjust max uploads. @@ -251,79 +236,65 @@ Toggle whether torrent ignores ratio settings. 3 | 4 - Adjust min peers. +Adjust min peers. 5 | 6 - Adjust max peers. +Adjust max peers. u - Display transfering blocks. - i - Display chunk rarity. - o - -Display the tracker list. Cycle the trackers in a group - - with the space-bar. +Display the tracker list. Cycle the trackers in a group with the +space-bar. p - View peer and torrent information. - t | T - Initiate tracker request. Use capital T to force the request, ignoring the "min interval" set by the tracker. - k - Disconnect peer. - * - Choke/Snub peer. - @@ -342,46 +313,36 @@ Choke/Snub peer. -b a.b.c.d - Bind listening socket and outgoing connections to this network interface address. - -d directory - Set the default download directory. Defaults to "./". - -h - Display help and exit. - -i a.b.c.d - Set the address reported to the tracker. - -n - Don't load ~/.rtorrent.rc on startup. - @@ -389,34 +350,28 @@ Don't load ~/.rtorrent.rc on startup. -o key1=opt1,... -O key=opt - Set any number of options, see the SETTINGS section. The options given here override the resource files. Use capital -O to allow comma in the option. - -p a-b - Try to open a listening port in the range a up to and including b. - -s directory - Session management will be enabled and the torrent files for all open downloads will be stored in this directory. Only one instance of rtorrent should be used with each session directory, though at the moment no locking is done. An empty string will disable the session directory. - @@ -435,75 +390,59 @@ directory. max_peers = value - Set the maximum number of peers to allow in each download. - min_peers = value - Set the minimum number of peers to try to connect to in each download. - max_peers_seed = value - Set the maximum number of peers to allow while seeding, or -1 (default) to use max_peers. - min_peers_seed = value - Set the minimum number of peers to try to connect to while seeding, or -1 (default) to use min_peers. - max_uploads = value - Set the maximum number of simultaneous uploads per download. - download_rate = KB - Set the maximum global download rate. - upload_rate = KB - Set the maximum global upload rate. - bind = a.b.c.d - Bind listening socket and outgoing connections to this network interface address. - @@ -511,86 +450,69 @@ interface address. ip = a.b.c.d ip = hostname - Set the address reported to the tracker. - port_range = a-b - Try to open a listening port in the range a up to and including b. - port_random = yes | no - Open the listening port at a random position in the port range. - check_hash = yes | no - Perform hash check on torrents that have finished downloading. - directory = directory - Set the default download directory. Defaults to "./". - session = directory - Session management will be enabled and the torrent files for all open downloads will be stored in this directory. Only one instance of rtorrent should be used with each session directory, though at the moment no locking is done. An empty string will disable the session directory. - http_proxy = url - Use a http proxy. Use an empty string to disable. - encoding_list = encoding - Add a preferred filename encoding to the list. The encodings are attempted in the order they are inserted, if none match the torrent default is used. - schedule = id,start,interval,command - Call command every interval seconds, starting from start. An interval of zero calls the task once, while a @@ -601,25 +523,20 @@ seconds, starting from start. An 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 = - Start torrents that are tied to filenames that have been re-added. - @@ -628,21 +545,17 @@ Start torrents that are tied to filenames that have been re-added. close_untied = remove_untied = - Stop, close or remove the torrents that are tied to filenames that have been deleted. Clear the association with the 'U' key. - close_low_diskspace = space - Close any active torrents on filesystems with less than space diskspace left. Use with the schedule option. - @@ -651,7 +564,6 @@ the schedule option. 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 @@ -661,7 +573,6 @@ 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. - @@ -671,13 +582,11 @@ Use with the schedule option. load_start = file load_start_verbose = file - Load and possibly start a file, or possibly multiple files by using the wild-card "*". This is meant for use with schedule, though ensure that the start is non-zero. The loaded file will be tied to the filename provided. - @@ -685,10 +594,8 @@ to the filename provided. import = file try_import = file - Load a resource file. try_import does not throw torrent::input_error exception on bad input. - @@ -708,9 +615,7 @@ torrent::input_error exception on bad input. view_add = name - Create a new view. - @@ -718,13 +623,11 @@ Create a new view. view_sort = name view_sort = name,seconds - Sort a view according the the criteria set by view_sort_current. If the optional argument is supplied, the view is not sorted if a change happened during the last seconds. This command is meant to be used with schedule. - diff --git a/rak/socket_address.h b/rak/socket_address.h index 0276c4e8..fd911f0c 100644 --- a/rak/socket_address.h +++ b/rak/socket_address.h @@ -76,8 +76,8 @@ public: // Should we need to set AF_UNSPEC? void clear() { std::memset(this, 0, sizeof(socket_address)); set_family(); } - sa_family_t family() const { return m_sa.m_sockaddr.sa_family; } - void set_family() { m_sa.m_sockaddr.sa_family = af_unspec; } + sa_family_t family() const { return m_sockaddr.sa_family; } + void set_family() { m_sockaddr.sa_family = af_unspec; } uint16_t port() const; void set_port(uint16_t p); @@ -95,18 +95,18 @@ public: socket_address_inet* sa_inet() { return reinterpret_cast(this); } const socket_address_inet* sa_inet() const { return reinterpret_cast(this); } - sockaddr* c_sockaddr() { return &m_sa.m_sockaddr; } - sockaddr_in* c_sockaddr_inet() { return &m_sa.m_sockaddrInet; } + sockaddr* c_sockaddr() { return &m_sockaddr; } + sockaddr_in* c_sockaddr_inet() { return &m_sockaddrInet; } - const sockaddr* c_sockaddr() const { return &m_sa.m_sockaddr; } - const sockaddr_in* c_sockaddr_inet() const { return &m_sa.m_sockaddrInet; } + const sockaddr* c_sockaddr() const { return &m_sockaddr; } + const sockaddr_in* c_sockaddr_inet() const { return &m_sockaddrInet; } #ifdef RAK_USE_INET6 socket_address_inet6* sa_inet6() { return reinterpret_cast(this); } const socket_address_inet6* sa_inet6() const { return reinterpret_cast(this); } - sockaddr_in6* c_sockaddr_inet6() { return &m_sa.m_sockaddrInet6; } - const sockaddr_in6* c_sockaddr_inet6() const { return &m_sa.m_sockaddrInet6; } + sockaddr_in6* c_sockaddr_inet6() { return &m_sockaddrInet6; } + const sockaddr_in6* c_sockaddr_inet6() const { return &m_sockaddrInet6; } #endif // Copy a socket address which has the length 'length. Zero out any @@ -120,18 +120,21 @@ public: // The different families will be sorted according to the // sa_family_t's numeric value. bool operator == (const socket_address& rhs) const; - bool operator < (const socket_address& rhs) const; + bool operator < (const socket_address& rhs) const; + + bool operator == (const sockaddr& rhs) const { return *this == *cast_from(&rhs); } + bool operator == (const sockaddr* rhs) const { return *this == *cast_from(rhs); } + bool operator < (const sockaddr& rhs) const { return *this == *cast_from(&rhs); } + bool operator < (const sockaddr* rhs) const { return *this == *cast_from(rhs); } private: - union sa_union { + union { sockaddr m_sockaddr; sockaddr_in m_sockaddrInet; #ifdef RAK_USE_INET6 sockaddr_in6 m_sockaddrInet6; #endif }; - - sa_union m_sa; }; // Remeber to set the AF_INET. @@ -181,6 +184,50 @@ private: struct sockaddr_in m_sockaddr; }; +// Unique key for the address, excluding port numbers etc. +class socket_address_key { +public: +// socket_address_host_key() {} + + socket_address_key(const socket_address& sa) { + *this = sa; + } + + socket_address_key& operator = (const socket_address& sa) { + if (sa.family() == 0) { + std::memset(this, 0, sizeof(socket_address_key)); + + } else if (sa.family() == socket_address::af_inet) { + // Using hardware order as we use operator < to compare when + // using inet only. + m_addr.s_addr = sa.sa_inet()->address_h(); + + } else { + // When we implement INET6 handling, embed the ipv4 address in + // the ipv6 address. + throw std::logic_error("socket_address_key(...) received an unsupported protocol family."); + } + + return *this; + } + +// socket_address_key& operator = (const socket_address_key& sa) { +// } + + bool operator < (const socket_address_key& sa) const { + // Compare the memory area instead. + return m_addr.s_addr < sa.m_addr.s_addr; + } + +private: + union { + in_addr m_addr; +// #ifdef RAK_USE_INET6 +// in_addr6 m_addr6; +// #endif + }; +}; + inline bool socket_address::is_valid() const { switch (family()) { diff --git a/src/ui/download_list.cc b/src/ui/download_list.cc index 6fa88fde..fa7f695a 100644 --- a/src/ui/download_list.cc +++ b/src/ui/download_list.cc @@ -321,10 +321,12 @@ DownloadList::setup_keys() { m_bindings['\x0F'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_CHANGE_DIRECTORY); m_bindings['X' - '@'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_COMMAND); - m_uiArray[DISPLAY_LOG]->bindings()[' '] = sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_DOWNLOAD_LIST); - m_uiArray[DISPLAY_LOG]->bindings()[KEY_LEFT] = sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_DOWNLOAD_LIST); + m_uiArray[DISPLAY_LOG]->bindings()[KEY_LEFT] = + m_uiArray[DISPLAY_LOG]->bindings()['B' - '@'] = + m_uiArray[DISPLAY_LOG]->bindings()[' '] = sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_DOWNLOAD_LIST); - m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()[KEY_RIGHT] = sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_DOWNLOAD); + m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()[KEY_RIGHT] = + m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()['F' - '@'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_DOWNLOAD); m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()['l'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_LOG); } diff --git a/src/ui/element_chunks_seen.cc b/src/ui/element_chunks_seen.cc index 1f6845eb..f8d350c3 100644 --- a/src/ui/element_chunks_seen.cc +++ b/src/ui/element_chunks_seen.cc @@ -52,7 +52,7 @@ ElementChunksSeen::ElementChunksSeen(core::Download* d) : m_window(NULL), m_focus(0) { - m_bindings[KEY_LEFT] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); + m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); m_bindings[KEY_DOWN] = sigc::mem_fun(*this, &ElementChunksSeen::receive_next); m_bindings[KEY_UP] = sigc::mem_fun(*this, &ElementChunksSeen::receive_prev); diff --git a/src/ui/element_file_list.cc b/src/ui/element_file_list.cc index a14c75fb..63dea7d3 100644 --- a/src/ui/element_file_list.cc +++ b/src/ui/element_file_list.cc @@ -53,15 +53,15 @@ ElementFileList::ElementFileList(core::Download* d) : m_window(NULL), m_focus(0) { - m_bindings[KEY_LEFT] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); + m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); m_bindings[' '] = sigc::mem_fun(*this, &ElementFileList::receive_priority); m_bindings['*'] = sigc::mem_fun(*this, &ElementFileList::receive_change_all); m_bindings[KEY_NPAGE] = sigc::mem_fun(*this, &ElementFileList::receive_pagenext); m_bindings[KEY_PPAGE] = sigc::mem_fun(*this, &ElementFileList::receive_pageprev); - m_bindings[KEY_DOWN] = m_bindings['P' - '@'] = sigc::mem_fun(*this, &ElementFileList::receive_next); - m_bindings[KEY_UP] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementFileList::receive_prev); + m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementFileList::receive_next); + m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(*this, &ElementFileList::receive_prev); } void diff --git a/src/ui/element_menu.cc b/src/ui/element_menu.cc index ab69f22f..53a811cd 100644 --- a/src/ui/element_menu.cc +++ b/src/ui/element_menu.cc @@ -72,8 +72,8 @@ ElementMenu::ElementMenu() : m_entry(entry_invalid) { // Move bindings into a function that defines default bindings. - m_bindings[KEY_LEFT] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); - m_bindings[KEY_RIGHT] = sigc::mem_fun(this, &ElementMenu::entry_select); + m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); + m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = sigc::mem_fun(this, &ElementMenu::entry_select); m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(this, &ElementMenu::entry_prev); m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(this, &ElementMenu::entry_next); diff --git a/src/ui/element_peer_list.cc b/src/ui/element_peer_list.cc index 74ae99dc..31dd4daa 100644 --- a/src/ui/element_peer_list.cc +++ b/src/ui/element_peer_list.cc @@ -72,8 +72,8 @@ ElementPeerList::ElementPeerList(core::Download* d) : m_bindings['k'] = sigc::mem_fun(this, &ElementPeerList::receive_disconnect_peer); m_bindings['*'] = sigc::mem_fun(this, &ElementPeerList::receive_snub_peer); - m_bindings[KEY_LEFT] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); - m_bindings[KEY_RIGHT] = sigc::bind(sigc::mem_fun(this, &ElementPeerList::activate_display), DISPLAY_INFO); + m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); + m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = sigc::bind(sigc::mem_fun(this, &ElementPeerList::activate_display), DISPLAY_INFO); m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(this, &ElementPeerList::receive_prev); m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(this, &ElementPeerList::receive_next); diff --git a/src/ui/element_text.cc b/src/ui/element_text.cc index 5d478346..8ad19c5e 100644 --- a/src/ui/element_text.cc +++ b/src/ui/element_text.cc @@ -54,11 +54,11 @@ ElementText::ElementText(void *object) : m_columnWidth(0) { // Move bindings into a function that defines default bindings. - m_bindings[KEY_LEFT] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); + m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); // m_bindings[KEY_UP] = sigc::mem_fun(this, &ElementText::entry_prev); // m_bindings[KEY_DOWN] = sigc::mem_fun(this, &ElementText::entry_next); -// m_bindings[KEY_RIGHT] = sigc::mem_fun(this, &ElementText::entry_select); +// m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = sigc::mem_fun(this, &ElementText::entry_select); } ElementText::~ElementText() { diff --git a/src/ui/element_tracker_list.cc b/src/ui/element_tracker_list.cc index d2def1c1..a978ba2b 100644 --- a/src/ui/element_tracker_list.cc +++ b/src/ui/element_tracker_list.cc @@ -54,13 +54,13 @@ ElementTrackerList::ElementTrackerList(core::Download* d) : m_window(NULL), m_focus(0) { - m_bindings[KEY_LEFT] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); + m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); m_bindings[' '] = sigc::mem_fun(*this, &ElementTrackerList::receive_cycle_group); m_bindings['*'] = sigc::mem_fun(*this, &ElementTrackerList::receive_disable); - m_bindings[KEY_DOWN] = m_bindings['P' - '@'] = sigc::mem_fun(*this, &ElementTrackerList::receive_next); - m_bindings[KEY_UP] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementTrackerList::receive_prev); + m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementTrackerList::receive_next); + m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(*this, &ElementTrackerList::receive_prev); } void diff --git a/src/ui/element_transfer_list.cc b/src/ui/element_transfer_list.cc index 0048b235..ab113692 100644 --- a/src/ui/element_transfer_list.cc +++ b/src/ui/element_transfer_list.cc @@ -52,7 +52,7 @@ ElementTransferList::ElementTransferList(core::Download* d) : m_window(NULL), m_focus(0) { - m_bindings[KEY_LEFT] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); + m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); m_bindings[KEY_DOWN] = sigc::mem_fun(*this, &ElementTransferList::receive_next); m_bindings[KEY_UP] = sigc::mem_fun(*this, &ElementTransferList::receive_prev);