* Fixed the man page to include the latest modifications.

* Bound ^F and ^B for navigating and swapped ^P and ^N in some windows
to get correct behavior.

* Sanitized and added PeerInfo and PeerList to the API.

* HashTorrent now waits for the last outstanding chunks finish before
allowing a chunk mapping error to bork the hashing.

* Lowered the default hash_interval to 5 msec and hash_max_tries to 5.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@765 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-08-24 23:55:33 +00:00
parent a3f7be3278
commit bb0f13144b
10 changed files with 107 additions and 155 deletions
+29 -126
View File
@@ -68,16 +68,12 @@ supporting B, K, M and G suffixes.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>up | down</term> <term>up | down | left | right arrow keys</term>
<term>^P | ^N | ^B | ^F</term>
<listitem><para> <listitem><para>
Select item. Select entries or change windows. The right arrow key or ^F is often
</para></listitem> used for viewing details about the selected entry, while the left
</varlistentry> arrow key or ^B often returns to the previous screen.
<varlistentry>
<term><-</term>
<listitem><para>
Go back to the previous screen.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
@@ -121,104 +117,94 @@ supporting B, K, M and G suffixes.
<varlistentry> <varlistentry>
<term>-></term> <term>-></term>
<listitem><para> <listitem><para>
View download. View download.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>1 - 7</term> <term>1 - 7</term>
<listitem><para> <listitem><para>
Change view. Change view.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>^S</term> <term>^S</term>
<listitem><para> <listitem><para>
Start download. Start download.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>^D</term> <term>^D</term>
<listitem><para> <listitem><para>
Stop an active download, or remove a stopped download. Stop an active download, or remove a stopped download.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>^K</term> <term>^K</term>
<listitem><para> <listitem><para>
Close a torrent and its files. Close a torrent and its files.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>^R</term> <term>^R</term>
<listitem><para> <listitem><para>
Initiate hash check of torrent. Initiate hash check of torrent.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>^O</term> <term>^O</term>
<listitem><para> <listitem><para>
Change the destination directory of the download. The Change the destination directory of the download. The torrent must be
torrent must be closed. closed.
</para></listitem>
</varlistentry>
<varlistentry>
<term>^X</term>
<listitem><para>
Call commands or change settings.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>+ | -</term> <term>+ | -</term>
<listitem><para> <listitem><para>
Change the priority of the download. Change the priority of the download.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>backspace</term> <term>backspace</term>
<listitem><para> <listitem><para>
Add torrent using an URL or file path. Use Add torrent using an URL or file path. Use
<emphasis>tab</emphasis> to view directory content and do <emphasis>tab</emphasis> to view directory content and do
auto-complete. auto-complete.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>l</term> <term>l</term>
<listitem><para> <listitem><para>
View log. Exit by pressing the space-bar. View log. Exit by pressing the space-bar.
</para></listitem>
</varlistentry>
<varlistentry>
<term>^P</term>
<listitem><para>
Call commands or change settings.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>U</term> <term>U</term>
<listitem><para> <listitem><para>
Delete the file the torrent is tied to, and clear the association. Delete the file the torrent is tied to, and clear the association.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>I</term> <term>I</term>
<listitem><para> <listitem><para>
Toggle whether torrent ignores ratio settings. Toggle whether torrent ignores ratio settings.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
@@ -234,16 +220,15 @@ Toggle whether torrent ignores ratio settings.
<varlistentry> <varlistentry>
<term>-></term> <term>-></term>
<listitem><para> <listitem><para>
View torrent file list. Use the space-bar to change the View torrent file list. Use the space-bar to change the file priority
file priority and <emphasis>*</emphasis> to change the and <emphasis>*</emphasis> to change the priority of all files.
priority of all files.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>1 | 2</term> <term>1 | 2</term>
<listitem><para> <listitem><para>
Adjust max uploads. Adjust max uploads.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
@@ -251,79 +236,65 @@ Toggle whether torrent ignores ratio settings.
<varlistentry> <varlistentry>
<term>3 | 4</term> <term>3 | 4</term>
<listitem><para> <listitem><para>
Adjust min peers. Adjust min peers.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>5 | 6</term> <term>5 | 6</term>
<listitem><para> <listitem><para>
Adjust max peers. Adjust max peers.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>u</term> <term>u</term>
<listitem><para> <listitem><para>
Display transfering blocks. Display transfering blocks.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>i</term> <term>i</term>
<listitem><para> <listitem><para>
Display chunk rarity. Display chunk rarity.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>o</term> <term>o</term>
<listitem><para> <listitem><para>
Display the tracker list. Cycle the trackers in a group with the
Display the tracker list. Cycle the trackers in a group space-bar.
with the space-bar.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>p</term> <term>p</term>
<listitem><para> <listitem><para>
View peer and torrent information. View peer and torrent information.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>t | T</term> <term>t | T</term>
<listitem><para> <listitem><para>
Initiate tracker request. Use capital T to force the request, ignoring Initiate tracker request. Use capital T to force the request, ignoring
the "min interval" set by the tracker. the "min interval" set by the tracker.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>k</term> <term>k</term>
<listitem><para> <listitem><para>
Disconnect peer. Disconnect peer.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>*</term> <term>*</term>
<listitem><para> <listitem><para>
Choke/Snub peer. Choke/Snub peer.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
@@ -342,46 +313,36 @@ Choke/Snub peer.
<varlistentry> <varlistentry>
<term>-b <replaceable>a.b.c.d</replaceable></term> <term>-b <replaceable>a.b.c.d</replaceable></term>
<listitem><para> <listitem><para>
Bind listening socket and outgoing connections to this network Bind listening socket and outgoing connections to this network
interface address. interface address.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>-d <replaceable>directory</replaceable></term> <term>-d <replaceable>directory</replaceable></term>
<listitem><para> <listitem><para>
Set the default download directory. Defaults to "./". Set the default download directory. Defaults to "./".
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>-h</term> <term>-h</term>
<listitem><para> <listitem><para>
Display help and exit. Display help and exit.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>-i <replaceable>a.b.c.d</replaceable></term> <term>-i <replaceable>a.b.c.d</replaceable></term>
<listitem><para> <listitem><para>
Set the address reported to the tracker. Set the address reported to the tracker.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>-n</term> <term>-n</term>
<listitem><para> <listitem><para>
Don't load ~/.rtorrent.rc on startup. Don't load ~/.rtorrent.rc on startup.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
@@ -389,34 +350,28 @@ Don't load ~/.rtorrent.rc on startup.
<term>-o key1=opt1,...</term> <term>-o key1=opt1,...</term>
<term>-O key=opt</term> <term>-O key=opt</term>
<listitem><para> <listitem><para>
Set any number of options, see the SETTINGS section. The options given Set any number of options, see the SETTINGS section. The options given
here override the resource files. Use capital <emphasis>-O</emphasis> here override the resource files. Use capital <emphasis>-O</emphasis>
to allow comma in the option. to allow comma in the option.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>-p <replaceable>a-b</replaceable></term> <term>-p <replaceable>a-b</replaceable></term>
<listitem><para> <listitem><para>
Try to open a listening port in the range <emphasis>a</emphasis> up to Try to open a listening port in the range <emphasis>a</emphasis> up to
and including <emphasis>b</emphasis>. and including <emphasis>b</emphasis>.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>-s <replaceable>directory</replaceable></term> <term>-s <replaceable>directory</replaceable></term>
<listitem><para> <listitem><para>
Session management will be enabled and the torrent files for all open Session management will be enabled and the torrent files for all open
downloads will be stored in this directory. Only one instance of downloads will be stored in this directory. Only one instance of
rtorrent should be used with each session directory, though at the rtorrent should be used with each session directory, though at the
moment no locking is done. An empty string will disable the session moment no locking is done. An empty string will disable the session
directory. directory.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
@@ -435,75 +390,59 @@ directory.
<varlistentry> <varlistentry>
<term>max_peers = <replaceable>value</replaceable></term> <term>max_peers = <replaceable>value</replaceable></term>
<listitem><para> <listitem><para>
Set the maximum number of peers to allow in each download. Set the maximum number of peers to allow in each download.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>min_peers = <replaceable>value</replaceable></term> <term>min_peers = <replaceable>value</replaceable></term>
<listitem><para> <listitem><para>
Set the minimum number of peers to try to connect to in each download. Set the minimum number of peers to try to connect to in each download.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>max_peers_seed = <replaceable>value</replaceable></term> <term>max_peers_seed = <replaceable>value</replaceable></term>
<listitem><para> <listitem><para>
Set the maximum number of peers to allow while seeding, or -1 (default) to use Set the maximum number of peers to allow while seeding, or -1 (default) to use
max_peers. max_peers.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>min_peers_seed = <replaceable>value</replaceable></term> <term>min_peers_seed = <replaceable>value</replaceable></term>
<listitem><para> <listitem><para>
Set the minimum number of peers to try to connect to while seeding, or -1 (default) to use Set the minimum number of peers to try to connect to while seeding, or -1 (default) to use
min_peers. min_peers.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>max_uploads = <replaceable>value</replaceable></term> <term>max_uploads = <replaceable>value</replaceable></term>
<listitem><para> <listitem><para>
Set the maximum number of simultaneous uploads per download. Set the maximum number of simultaneous uploads per download.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>download_rate = <replaceable>KB</replaceable></term> <term>download_rate = <replaceable>KB</replaceable></term>
<listitem><para> <listitem><para>
Set the maximum global download rate. Set the maximum global download rate.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>upload_rate = <replaceable>KB</replaceable></term> <term>upload_rate = <replaceable>KB</replaceable></term>
<listitem><para> <listitem><para>
Set the maximum global upload rate. Set the maximum global upload rate.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>bind = <replaceable>a.b.c.d</replaceable></term> <term>bind = <replaceable>a.b.c.d</replaceable></term>
<listitem><para> <listitem><para>
Bind listening socket and outgoing connections to this network Bind listening socket and outgoing connections to this network
interface address. interface address.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
@@ -511,86 +450,69 @@ interface address.
<term>ip = <replaceable>a.b.c.d</replaceable></term> <term>ip = <replaceable>a.b.c.d</replaceable></term>
<term>ip = <replaceable>hostname</replaceable></term> <term>ip = <replaceable>hostname</replaceable></term>
<listitem><para> <listitem><para>
Set the address reported to the tracker. Set the address reported to the tracker.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>port_range = <replaceable>a-b</replaceable></term> <term>port_range = <replaceable>a-b</replaceable></term>
<listitem><para> <listitem><para>
Try to open a listening port in the range <emphasis>a</emphasis> up to Try to open a listening port in the range <emphasis>a</emphasis> up to
and including <emphasis>b</emphasis>. and including <emphasis>b</emphasis>.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>port_random = <replaceable>yes | no</replaceable></term> <term>port_random = <replaceable>yes | no</replaceable></term>
<listitem><para> <listitem><para>
Open the listening port at a random position in the port range. Open the listening port at a random position in the port range.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>check_hash = <replaceable>yes | no</replaceable></term> <term>check_hash = <replaceable>yes | no</replaceable></term>
<listitem><para> <listitem><para>
Perform hash check on torrents that have finished downloading. Perform hash check on torrents that have finished downloading.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>directory = <replaceable>directory</replaceable></term> <term>directory = <replaceable>directory</replaceable></term>
<listitem><para> <listitem><para>
Set the default download directory. Defaults to "./". Set the default download directory. Defaults to "./".
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>session = <replaceable>directory</replaceable></term> <term>session = <replaceable>directory</replaceable></term>
<listitem><para> <listitem><para>
Session management will be enabled and the torrent files for all open Session management will be enabled and the torrent files for all open
downloads will be stored in this directory. Only one instance of downloads will be stored in this directory. Only one instance of
rtorrent should be used with each session directory, though at the rtorrent should be used with each session directory, though at the
moment no locking is done. An empty string will disable the session moment no locking is done. An empty string will disable the session
directory. directory.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>http_proxy = <replaceable>url</replaceable></term> <term>http_proxy = <replaceable>url</replaceable></term>
<listitem><para> <listitem><para>
Use a http proxy. Use an empty string to disable. Use a http proxy. Use an empty string to disable.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>encoding_list = <replaceable>encoding</replaceable></term> <term>encoding_list = <replaceable>encoding</replaceable></term>
<listitem><para> <listitem><para>
Add a preferred filename encoding to the list. The encodings are Add a preferred filename encoding to the list. The encodings are
attempted in the order they are inserted, if none match the torrent attempted in the order they are inserted, if none match the torrent
default is used. default is used.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>schedule = <replaceable>id</replaceable>,<replaceable>start</replaceable>,<replaceable>interval</replaceable>,<replaceable>command</replaceable></term> <term>schedule = <replaceable>id</replaceable>,<replaceable>start</replaceable>,<replaceable>interval</replaceable>,<replaceable>command</replaceable></term>
<listitem><para> <listitem><para>
Call <emphasis>command</emphasis> every <emphasis>interval</emphasis> Call <emphasis>command</emphasis> every <emphasis>interval</emphasis>
seconds, starting from <emphasis>start</emphasis>. An seconds, starting from <emphasis>start</emphasis>. An
<emphasis>interval</emphasis> of zero calls the task once, while a <emphasis>interval</emphasis> of zero calls the task once, while a
@@ -601,25 +523,20 @@ seconds, starting from <emphasis>start</emphasis>. An
optionally use a time format, <emphasis>dd:hh:mm:ss</emphasis>. F.ex to optionally use a time format, <emphasis>dd:hh:mm:ss</emphasis>. F.ex to
start a task every day at <emphasis>18:00</emphasis>, use start a task every day at <emphasis>18:00</emphasis>, use
<emphasis>18:00:00,24:00:00</emphasis>. <emphasis>18:00:00,24:00:00</emphasis>.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>schedule_remove = <replaceable>id</replaceable></term> <term>schedule_remove = <replaceable>id</replaceable></term>
<listitem><para> <listitem><para>
Delete <emphasis>id</emphasis> from the scheduler. Delete <emphasis>id</emphasis> from the scheduler.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>start_tied =</term> <term>start_tied =</term>
<listitem><para> <listitem><para>
Start torrents that are tied to filenames that have been re-added. Start torrents that are tied to filenames that have been re-added.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
@@ -628,21 +545,17 @@ Start torrents that are tied to filenames that have been re-added.
<term>close_untied =</term> <term>close_untied =</term>
<term>remove_untied =</term> <term>remove_untied =</term>
<listitem><para> <listitem><para>
Stop, close or remove the torrents that are tied to filenames that Stop, close or remove the torrents that are tied to filenames that
have been deleted. Clear the association with the 'U' key. have been deleted. Clear the association with the 'U' key.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>close_low_diskspace = <replaceable>space</replaceable></term> <term>close_low_diskspace = <replaceable>space</replaceable></term>
<listitem><para> <listitem><para>
Close any active torrents on filesystems with less than Close any active torrents on filesystems with less than
<emphasis>space</emphasis> diskspace left. Use with <emphasis>space</emphasis> diskspace left. Use with
the <emphasis>schedule</emphasis> option. the <emphasis>schedule</emphasis> option.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
@@ -651,7 +564,6 @@ the <emphasis>schedule</emphasis> option.
<term>stop_on_ratio = <replaceable>min_ratio</replaceable>,<replaceable>min_upload</replaceable></term> <term>stop_on_ratio = <replaceable>min_ratio</replaceable>,<replaceable>min_upload</replaceable></term>
<term>stop_on_ratio = <replaceable>min_ratio</replaceable>,<replaceable>min_upload</replaceable>,<replaceable>max_ratio</replaceable></term> <term>stop_on_ratio = <replaceable>min_ratio</replaceable>,<replaceable>min_upload</replaceable>,<replaceable>max_ratio</replaceable></term>
<listitem><para> <listitem><para>
Stop torrents when they reach the given upload ratio Stop torrents when they reach the given upload ratio
<emphasis>min_ratio</emphasis> in percent. If the optional <emphasis>min_ratio</emphasis> in percent. If the optional
<emphasis>min_upload</emphasis> is given, require a total <emphasis>min_upload</emphasis> is given, require a total
@@ -661,7 +573,6 @@ when reaching this ratio regardless of the total upload
amount. Exclude certain torrent by pressing amount. Exclude certain torrent by pressing
<emphasis>Shift+I</emphasis> in the downlist list. <emphasis>Shift+I</emphasis> in the downlist list.
Use with the <emphasis>schedule</emphasis> option. Use with the <emphasis>schedule</emphasis> option.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
@@ -671,13 +582,11 @@ Use with the <emphasis>schedule</emphasis> option.
<term>load_start = <replaceable>file</replaceable></term> <term>load_start = <replaceable>file</replaceable></term>
<term>load_start_verbose = <replaceable>file</replaceable></term> <term>load_start_verbose = <replaceable>file</replaceable></term>
<listitem><para> <listitem><para>
Load and possibly start a file, or possibly multiple files by using the Load and possibly start a file, or possibly multiple files by using the
wild-card "*". This is meant for use with wild-card "*". This is meant for use with
<emphasis>schedule</emphasis>, though ensure that the <emphasis>schedule</emphasis>, though ensure that the
<emphasis>start</emphasis> is non-zero. The loaded file will be tied <emphasis>start</emphasis> is non-zero. The loaded file will be tied
to the filename provided. to the filename provided.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
@@ -685,10 +594,8 @@ to the filename provided.
<term>import = <replaceable>file</replaceable></term> <term>import = <replaceable>file</replaceable></term>
<term>try_import = <replaceable>file</replaceable></term> <term>try_import = <replaceable>file</replaceable></term>
<listitem><para> <listitem><para>
Load a resource file. <emphasis>try_import</emphasis> does not throw Load a resource file. <emphasis>try_import</emphasis> does not throw
torrent::input_error exception on bad input. torrent::input_error exception on bad input.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
@@ -708,9 +615,7 @@ torrent::input_error exception on bad input.
<varlistentry> <varlistentry>
<term>view_add = <replaceable>name</replaceable></term> <term>view_add = <replaceable>name</replaceable></term>
<listitem><para> <listitem><para>
Create a new view. Create a new view.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
@@ -718,13 +623,11 @@ Create a new view.
<term>view_sort = <replaceable>name</replaceable></term> <term>view_sort = <replaceable>name</replaceable></term>
<term>view_sort = <replaceable>name</replaceable>,<replaceable>seconds</replaceable></term> <term>view_sort = <replaceable>name</replaceable>,<replaceable>seconds</replaceable></term>
<listitem><para> <listitem><para>
Sort a view according the the criteria set by Sort a view according the the criteria set by
<emphasis>view_sort_current</emphasis>. If the optional argument is <emphasis>view_sort_current</emphasis>. If the optional argument is
supplied, the view is not sorted if a change happened during the last supplied, the view is not sorted if a change happened during the last
<emphasis>seconds</emphasis>. This command is meant to be used with <emphasis>seconds</emphasis>. This command is meant to be used with
<emphasis>schedule</emphasis>. <emphasis>schedule</emphasis>.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
+59 -12
View File
@@ -76,8 +76,8 @@ public:
// Should we need to set AF_UNSPEC? // Should we need to set AF_UNSPEC?
void clear() { std::memset(this, 0, sizeof(socket_address)); set_family(); } void clear() { std::memset(this, 0, sizeof(socket_address)); set_family(); }
sa_family_t family() const { return m_sa.m_sockaddr.sa_family; } sa_family_t family() const { return m_sockaddr.sa_family; }
void set_family() { m_sa.m_sockaddr.sa_family = af_unspec; } void set_family() { m_sockaddr.sa_family = af_unspec; }
uint16_t port() const; uint16_t port() const;
void set_port(uint16_t p); void set_port(uint16_t p);
@@ -95,18 +95,18 @@ public:
socket_address_inet* sa_inet() { return reinterpret_cast<socket_address_inet*>(this); } socket_address_inet* sa_inet() { return reinterpret_cast<socket_address_inet*>(this); }
const socket_address_inet* sa_inet() const { return reinterpret_cast<const socket_address_inet*>(this); } const socket_address_inet* sa_inet() const { return reinterpret_cast<const socket_address_inet*>(this); }
sockaddr* c_sockaddr() { return &m_sa.m_sockaddr; } sockaddr* c_sockaddr() { return &m_sockaddr; }
sockaddr_in* c_sockaddr_inet() { return &m_sa.m_sockaddrInet; } sockaddr_in* c_sockaddr_inet() { return &m_sockaddrInet; }
const sockaddr* c_sockaddr() const { return &m_sa.m_sockaddr; } const sockaddr* c_sockaddr() const { return &m_sockaddr; }
const sockaddr_in* c_sockaddr_inet() const { return &m_sa.m_sockaddrInet; } const sockaddr_in* c_sockaddr_inet() const { return &m_sockaddrInet; }
#ifdef RAK_USE_INET6 #ifdef RAK_USE_INET6
socket_address_inet6* sa_inet6() { return reinterpret_cast<socket_address_inet6*>(this); } socket_address_inet6* sa_inet6() { return reinterpret_cast<socket_address_inet6*>(this); }
const socket_address_inet6* sa_inet6() const { return reinterpret_cast<const socket_address_inet6*>(this); } const socket_address_inet6* sa_inet6() const { return reinterpret_cast<const socket_address_inet6*>(this); }
sockaddr_in6* c_sockaddr_inet6() { return &m_sa.m_sockaddrInet6; } sockaddr_in6* c_sockaddr_inet6() { return &m_sockaddrInet6; }
const sockaddr_in6* c_sockaddr_inet6() const { return &m_sa.m_sockaddrInet6; } const sockaddr_in6* c_sockaddr_inet6() const { return &m_sockaddrInet6; }
#endif #endif
// Copy a socket address which has the length 'length. Zero out any // 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 // The different families will be sorted according to the
// sa_family_t's numeric value. // 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 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: private:
union sa_union { union {
sockaddr m_sockaddr; sockaddr m_sockaddr;
sockaddr_in m_sockaddrInet; sockaddr_in m_sockaddrInet;
#ifdef RAK_USE_INET6 #ifdef RAK_USE_INET6
sockaddr_in6 m_sockaddrInet6; sockaddr_in6 m_sockaddrInet6;
#endif #endif
}; };
sa_union m_sa;
}; };
// Remeber to set the AF_INET. // Remeber to set the AF_INET.
@@ -181,6 +184,50 @@ private:
struct sockaddr_in m_sockaddr; 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 inline bool
socket_address::is_valid() const { socket_address::is_valid() const {
switch (family()) { switch (family()) {
+5 -3
View File
@@ -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['\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_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] =
m_uiArray[DISPLAY_LOG]->bindings()[KEY_LEFT] = sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_DOWNLOAD_LIST); 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); m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()['l'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_LOG);
} }
+1 -1
View File
@@ -52,7 +52,7 @@ ElementChunksSeen::ElementChunksSeen(core::Download* d) :
m_window(NULL), m_window(NULL),
m_focus(0) { 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_DOWN] = sigc::mem_fun(*this, &ElementChunksSeen::receive_next);
m_bindings[KEY_UP] = sigc::mem_fun(*this, &ElementChunksSeen::receive_prev); m_bindings[KEY_UP] = sigc::mem_fun(*this, &ElementChunksSeen::receive_prev);
+3 -3
View File
@@ -53,15 +53,15 @@ ElementFileList::ElementFileList(core::Download* d) :
m_window(NULL), m_window(NULL),
m_focus(0) { 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_priority);
m_bindings['*'] = sigc::mem_fun(*this, &ElementFileList::receive_change_all); m_bindings['*'] = sigc::mem_fun(*this, &ElementFileList::receive_change_all);
m_bindings[KEY_NPAGE] = sigc::mem_fun(*this, &ElementFileList::receive_pagenext); 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_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_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementFileList::receive_next);
m_bindings[KEY_UP] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementFileList::receive_prev); m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(*this, &ElementFileList::receive_prev);
} }
void void
+2 -2
View File
@@ -72,8 +72,8 @@ ElementMenu::ElementMenu() :
m_entry(entry_invalid) { m_entry(entry_invalid) {
// Move bindings into a function that defines default bindings. // 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_RIGHT] = sigc::mem_fun(this, &ElementMenu::entry_select); 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_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); m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(this, &ElementMenu::entry_next);
+2 -2
View File
@@ -72,8 +72,8 @@ ElementPeerList::ElementPeerList(core::Download* d) :
m_bindings['k'] = sigc::mem_fun(this, &ElementPeerList::receive_disconnect_peer); m_bindings['k'] = sigc::mem_fun(this, &ElementPeerList::receive_disconnect_peer);
m_bindings['*'] = sigc::mem_fun(this, &ElementPeerList::receive_snub_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_LEFT] = m_bindings['B' - '@'] = 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_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_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); m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(this, &ElementPeerList::receive_next);
+2 -2
View File
@@ -54,11 +54,11 @@ ElementText::ElementText(void *object) :
m_columnWidth(0) { m_columnWidth(0) {
// Move bindings into a function that defines default bindings. // 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_UP] = sigc::mem_fun(this, &ElementText::entry_prev);
// m_bindings[KEY_DOWN] = sigc::mem_fun(this, &ElementText::entry_next); // 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() { ElementText::~ElementText() {
+3 -3
View File
@@ -54,13 +54,13 @@ ElementTrackerList::ElementTrackerList(core::Download* d) :
m_window(NULL), m_window(NULL),
m_focus(0) { 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_cycle_group);
m_bindings['*'] = sigc::mem_fun(*this, &ElementTrackerList::receive_disable); 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_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementTrackerList::receive_next);
m_bindings[KEY_UP] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementTrackerList::receive_prev); m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(*this, &ElementTrackerList::receive_prev);
} }
void void
+1 -1
View File
@@ -52,7 +52,7 @@ ElementTransferList::ElementTransferList(core::Download* d) :
m_window(NULL), m_window(NULL),
m_focus(0) { 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_DOWN] = sigc::mem_fun(*this, &ElementTransferList::receive_next);
m_bindings[KEY_UP] = sigc::mem_fun(*this, &ElementTransferList::receive_prev); m_bindings[KEY_UP] = sigc::mem_fun(*this, &ElementTransferList::receive_prev);