added alerts for reporting nat-pmp status
This commit is contained in:
parent
de69453826
commit
118e1cf00d
|
@ -50,6 +50,7 @@ following features:</p>
|
|||
<li>trackerless torrents (using the Mainline kademlia DHT protocol) with
|
||||
some <a class="reference" href="dht_extensions.html">DHT extensions</a>.</li>
|
||||
<li>support for IPv6</li>
|
||||
<li>NAT-PMP support (automatic port mapping on routers that supports it)</li>
|
||||
<li>piece-wise, unordered, incremental file allocation</li>
|
||||
<li>uses separate threads for checking files and for main downloader, with a
|
||||
fool-proof thread-safe library interface. (i.e. There's no way for the
|
||||
|
|
|
@ -120,48 +120,50 @@
|
|||
</li>
|
||||
<li><a class="reference" href="#alerts" id="id98" name="id98">alerts</a><ul>
|
||||
<li><a class="reference" href="#listen-failed-alert" id="id99" name="id99">listen_failed_alert</a></li>
|
||||
<li><a class="reference" href="#file-error-alert" id="id100" name="id100">file_error_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-announce-alert" id="id101" name="id101">tracker_announce_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-alert" id="id102" name="id102">tracker_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-reply-alert" id="id103" name="id103">tracker_reply_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-warning-alert" id="id104" name="id104">tracker_warning_alert</a></li>
|
||||
<li><a class="reference" href="#url-seed-alert" id="id105" name="id105">url_seed_alert</a></li>
|
||||
<li><a class="reference" href="#hash-failed-alert" id="id106" name="id106">hash_failed_alert</a></li>
|
||||
<li><a class="reference" href="#peer-ban-alert" id="id107" name="id107">peer_ban_alert</a></li>
|
||||
<li><a class="reference" href="#peer-error-alert" id="id108" name="id108">peer_error_alert</a></li>
|
||||
<li><a class="reference" href="#invalid-request-alert" id="id109" name="id109">invalid_request_alert</a></li>
|
||||
<li><a class="reference" href="#torrent-finished-alert" id="id110" name="id110">torrent_finished_alert</a></li>
|
||||
<li><a class="reference" href="#metadata-failed-alert" id="id111" name="id111">metadata_failed_alert</a></li>
|
||||
<li><a class="reference" href="#metadata-received-alert" id="id112" name="id112">metadata_received_alert</a></li>
|
||||
<li><a class="reference" href="#fastresume-rejected-alert" id="id113" name="id113">fastresume_rejected_alert</a></li>
|
||||
<li><a class="reference" href="#dispatcher" id="id114" name="id114">dispatcher</a></li>
|
||||
<li><a class="reference" href="#portmap-error-alert" id="id100" name="id100">portmap_error_alert</a></li>
|
||||
<li><a class="reference" href="#portmap-alert" id="id101" name="id101">portmap_alert</a></li>
|
||||
<li><a class="reference" href="#file-error-alert" id="id102" name="id102">file_error_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-announce-alert" id="id103" name="id103">tracker_announce_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-alert" id="id104" name="id104">tracker_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-reply-alert" id="id105" name="id105">tracker_reply_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-warning-alert" id="id106" name="id106">tracker_warning_alert</a></li>
|
||||
<li><a class="reference" href="#url-seed-alert" id="id107" name="id107">url_seed_alert</a></li>
|
||||
<li><a class="reference" href="#hash-failed-alert" id="id108" name="id108">hash_failed_alert</a></li>
|
||||
<li><a class="reference" href="#peer-ban-alert" id="id109" name="id109">peer_ban_alert</a></li>
|
||||
<li><a class="reference" href="#peer-error-alert" id="id110" name="id110">peer_error_alert</a></li>
|
||||
<li><a class="reference" href="#invalid-request-alert" id="id111" name="id111">invalid_request_alert</a></li>
|
||||
<li><a class="reference" href="#torrent-finished-alert" id="id112" name="id112">torrent_finished_alert</a></li>
|
||||
<li><a class="reference" href="#metadata-failed-alert" id="id113" name="id113">metadata_failed_alert</a></li>
|
||||
<li><a class="reference" href="#metadata-received-alert" id="id114" name="id114">metadata_received_alert</a></li>
|
||||
<li><a class="reference" href="#fastresume-rejected-alert" id="id115" name="id115">fastresume_rejected_alert</a></li>
|
||||
<li><a class="reference" href="#dispatcher" id="id116" name="id116">dispatcher</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#exceptions" id="id115" name="id115">exceptions</a><ul>
|
||||
<li><a class="reference" href="#invalid-handle" id="id116" name="id116">invalid_handle</a></li>
|
||||
<li><a class="reference" href="#duplicate-torrent" id="id117" name="id117">duplicate_torrent</a></li>
|
||||
<li><a class="reference" href="#invalid-encoding" id="id118" name="id118">invalid_encoding</a></li>
|
||||
<li><a class="reference" href="#type-error" id="id119" name="id119">type_error</a></li>
|
||||
<li><a class="reference" href="#invalid-torrent-file" id="id120" name="id120">invalid_torrent_file</a></li>
|
||||
<li><a class="reference" href="#exceptions" id="id117" name="id117">exceptions</a><ul>
|
||||
<li><a class="reference" href="#invalid-handle" id="id118" name="id118">invalid_handle</a></li>
|
||||
<li><a class="reference" href="#duplicate-torrent" id="id119" name="id119">duplicate_torrent</a></li>
|
||||
<li><a class="reference" href="#invalid-encoding" id="id120" name="id120">invalid_encoding</a></li>
|
||||
<li><a class="reference" href="#type-error" id="id121" name="id121">type_error</a></li>
|
||||
<li><a class="reference" href="#invalid-torrent-file" id="id122" name="id122">invalid_torrent_file</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#fast-resume" id="id121" name="id121">fast resume</a><ul>
|
||||
<li><a class="reference" href="#file-format" id="id122" name="id122">file format</a></li>
|
||||
<li><a class="reference" href="#fast-resume" id="id123" name="id123">fast resume</a><ul>
|
||||
<li><a class="reference" href="#file-format" id="id124" name="id124">file format</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#threads" id="id123" name="id123">threads</a></li>
|
||||
<li><a class="reference" href="#storage-allocation" id="id124" name="id124">storage allocation</a><ul>
|
||||
<li><a class="reference" href="#full-allocation" id="id125" name="id125">full allocation</a></li>
|
||||
<li><a class="reference" href="#compact-allocation" id="id126" name="id126">compact allocation</a></li>
|
||||
<li><a class="reference" href="#threads" id="id125" name="id125">threads</a></li>
|
||||
<li><a class="reference" href="#storage-allocation" id="id126" name="id126">storage allocation</a><ul>
|
||||
<li><a class="reference" href="#full-allocation" id="id127" name="id127">full allocation</a></li>
|
||||
<li><a class="reference" href="#compact-allocation" id="id128" name="id128">compact allocation</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#extensions" id="id127" name="id127">extensions</a><ul>
|
||||
<li><a class="reference" href="#metadata-from-peers" id="id128" name="id128">metadata from peers</a></li>
|
||||
<li><a class="reference" href="#http-seeding" id="id129" name="id129">HTTP seeding</a></li>
|
||||
<li><a class="reference" href="#extensions" id="id129" name="id129">extensions</a><ul>
|
||||
<li><a class="reference" href="#metadata-from-peers" id="id130" name="id130">metadata from peers</a></li>
|
||||
<li><a class="reference" href="#http-seeding" id="id131" name="id131">HTTP seeding</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#filename-checks" id="id130" name="id130">filename checks</a></li>
|
||||
<li><a class="reference" href="#acknowledgments" id="id131" name="id131">acknowledgments</a></li>
|
||||
<li><a class="reference" href="#filename-checks" id="id132" name="id132">filename checks</a></li>
|
||||
<li><a class="reference" href="#acknowledgments" id="id133" name="id133">acknowledgments</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section">
|
||||
|
@ -2462,6 +2464,39 @@ struct listen_failed_alert: alert
|
|||
</pre>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="portmap-error-alert" name="portmap-error-alert">portmap_error_alert</a></h2>
|
||||
<p>This alert is generated when a NAT router was successfully found but some
|
||||
part of the port mapping request failed. It contains a text message that
|
||||
may help the user figure out what is wrong. This alert is not generated in
|
||||
case it appears the client is not running on a NAT:ed network or if it
|
||||
appears there is no NAT router that can be remote controlled to add port
|
||||
mappings.</p>
|
||||
<p>The alert is generated as severity <tt class="docutils literal"><span class="pre">warning</span></tt>, since it should be displayed
|
||||
to the user somehow, and could mean reduced preformance.</p>
|
||||
<pre class="literal-block">
|
||||
struct portmap_error_alert: alert
|
||||
{
|
||||
portmap_error_alert(const std::string& msg);
|
||||
virtual std::auto_ptr<alert> clone() const;
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="portmap-alert" name="portmap-alert">portmap_alert</a></h2>
|
||||
<p>This alert is generated when a NAT router was successfully found and
|
||||
a port was successfully mapped on it. On a NAT:ed network with a NAT-PMP
|
||||
capable router, this is typically generated once when mapping the TCP
|
||||
port and, if DHT is enabled, when the UDP port is mapped. This is merely
|
||||
an informational alert, and is generated at severity level <tt class="docutils literal"><span class="pre">info</span></tt>.</p>
|
||||
<pre class="literal-block">
|
||||
struct portmap_alert: alert
|
||||
{
|
||||
portmap_alert(const std::string& msg);
|
||||
virtual std::auto_ptr<alert> clone() const;
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="file-error-alert" name="file-error-alert">file_error_alert</a></h2>
|
||||
<p>If the storage fails to read or write files that it needs access to, this alert is
|
||||
generated and the torrent is paused. It is generated as severity level <tt class="docutils literal"><span class="pre">fatal</span></tt>.</p>
|
||||
|
|
|
@ -2503,6 +2503,43 @@ level ``fatal``.
|
|||
virtual std::auto_ptr<alert> clone() const;
|
||||
};
|
||||
|
||||
portmap_error_alert
|
||||
-------------------
|
||||
|
||||
This alert is generated when a NAT router was successfully found but some
|
||||
part of the port mapping request failed. It contains a text message that
|
||||
may help the user figure out what is wrong. This alert is not generated in
|
||||
case it appears the client is not running on a NAT:ed network or if it
|
||||
appears there is no NAT router that can be remote controlled to add port
|
||||
mappings.
|
||||
|
||||
The alert is generated as severity ``warning``, since it should be displayed
|
||||
to the user somehow, and could mean reduced preformance.
|
||||
|
||||
::
|
||||
|
||||
struct portmap_error_alert: alert
|
||||
{
|
||||
portmap_error_alert(const std::string& msg);
|
||||
virtual std::auto_ptr<alert> clone() const;
|
||||
};
|
||||
|
||||
portmap_alert
|
||||
-------------
|
||||
|
||||
This alert is generated when a NAT router was successfully found and
|
||||
a port was successfully mapped on it. On a NAT:ed network with a NAT-PMP
|
||||
capable router, this is typically generated once when mapping the TCP
|
||||
port and, if DHT is enabled, when the UDP port is mapped. This is merely
|
||||
an informational alert, and is generated at severity level ``info``.
|
||||
|
||||
::
|
||||
|
||||
struct portmap_alert: alert
|
||||
{
|
||||
portmap_alert(const std::string& msg);
|
||||
virtual std::auto_ptr<alert> clone() const;
|
||||
};
|
||||
|
||||
file_error_alert
|
||||
----------------
|
||||
|
|
|
@ -249,6 +249,26 @@ namespace libtorrent
|
|||
{ return std::auto_ptr<alert>(new listen_failed_alert(*this)); }
|
||||
};
|
||||
|
||||
struct TORRENT_EXPORT portmap_error_alert: alert
|
||||
{
|
||||
portmap_error_alert(const std::string& msg)
|
||||
: alert(alert::warning, msg)
|
||||
{}
|
||||
|
||||
virtual std::auto_ptr<alert> clone() const
|
||||
{ return std::auto_ptr<alert>(new portmap_error_alert(*this)); }
|
||||
};
|
||||
|
||||
struct TORRENT_EXPORT portmap_alert: alert
|
||||
{
|
||||
portmap_alert(const std::string& msg)
|
||||
: alert(alert::info, msg)
|
||||
{}
|
||||
|
||||
virtual std::auto_ptr<alert> clone() const
|
||||
{ return std::auto_ptr<alert>(new portmap_alert(*this)); }
|
||||
};
|
||||
|
||||
struct TORRENT_EXPORT fastresume_rejected_alert: torrent_alert
|
||||
{
|
||||
fastresume_rejected_alert(torrent_handle const& h
|
||||
|
|
|
@ -1492,19 +1492,34 @@ namespace libtorrent { namespace detail
|
|||
{
|
||||
m_external_udp_port = udp_port;
|
||||
m_dht_settings.service_port = udp_port;
|
||||
// TODO: generate successful port map alert
|
||||
if (m_alerts.should_post(alert::info))
|
||||
{
|
||||
std::stringstream msg;
|
||||
msg << "successfully mapped UDP port " << udp_port;
|
||||
m_alerts.post_alert(portmap_alert(msg.str()));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (tcp_port != 0)
|
||||
{
|
||||
m_external_listen_port = tcp_port;
|
||||
// TODO: generate successful port map alert
|
||||
if (m_alerts.should_post(alert::info))
|
||||
{
|
||||
std::stringstream msg;
|
||||
msg << "successfully mapped TCP port " << tcp_port;
|
||||
m_alerts.post_alert(portmap_alert(msg.str()));
|
||||
}
|
||||
}
|
||||
|
||||
if (!errmsg.empty())
|
||||
{
|
||||
// TODO: generate port map failure alert
|
||||
if (m_alerts.should_post(alert::warning))
|
||||
{
|
||||
std::stringstream msg;
|
||||
msg << "Error while mapping ports on NAT router: " << errmsg;
|
||||
m_alerts.post_alert(portmap_error_alert(msg.str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue