added url to tracker alerts. introduced a base class for all tracker alerts

This commit is contained in:
Arvid Norberg 2008-04-23 01:54:21 +00:00
parent 05c1a64c76
commit 7a432786e7
9 changed files with 168 additions and 109 deletions

View File

@ -37,7 +37,7 @@
<li><a class="reference internal" href="#set-max-uploads-set-max-connections" id="id27">set_max_uploads() set_max_connections()</a></li>
<li><a class="reference internal" href="#num-uploads-num-connections" id="id28">num_uploads() num_connections()</a></li>
<li><a class="reference internal" href="#set-max-half-open-connections-max-half-open-connections" id="id29">set_max_half_open_connections() max_half_open_connections()</a></li>
<li><a class="reference internal" href="#load-asnum-db-load-country-db" id="id30">load_asnum_db() load_country_db()</a></li>
<li><a class="reference internal" href="#load-asnum-db-load-country-db-int-as-for-ip" id="id30">load_asnum_db() load_country_db() int as_for_ip()</a></li>
<li><a class="reference internal" href="#load-state-state" id="id31">load_state() state()</a></li>
<li><a class="reference internal" href="#set-ip-filter" id="id32">set_ip_filter()</a></li>
<li><a class="reference internal" href="#status" id="id33">status()</a></li>
@ -148,67 +148,68 @@
<li><a class="reference internal" href="#file-error-alert" id="id124">file_error_alert</a></li>
<li><a class="reference internal" href="#tracker-announce-alert" id="id125">tracker_announce_alert</a></li>
<li><a class="reference internal" href="#tracker-alert" id="id126">tracker_alert</a></li>
<li><a class="reference internal" href="#tracker-reply-alert" id="id127">tracker_reply_alert</a></li>
<li><a class="reference internal" href="#tracker-warning-alert" id="id128">tracker_warning_alert</a></li>
<li><a class="reference internal" href="#scrape-reply-alert" id="id129">scrape_reply_alert</a></li>
<li><a class="reference internal" href="#scrape-failed-alert" id="id130">scrape_failed_alert</a></li>
<li><a class="reference internal" href="#url-seed-alert" id="id131">url_seed_alert</a></li>
<li><a class="reference internal" href="#hash-failed-alert" id="id132">hash_failed_alert</a></li>
<li><a class="reference internal" href="#peer-ban-alert" id="id133">peer_ban_alert</a></li>
<li><a class="reference internal" href="#peer-error-alert" id="id134">peer_error_alert</a></li>
<li><a class="reference internal" href="#invalid-request-alert" id="id135">invalid_request_alert</a></li>
<li><a class="reference internal" href="#torrent-finished-alert" id="id136">torrent_finished_alert</a></li>
<li><a class="reference internal" href="#metadata-failed-alert" id="id137">metadata_failed_alert</a></li>
<li><a class="reference internal" href="#metadata-received-alert" id="id138">metadata_received_alert</a></li>
<li><a class="reference internal" href="#fastresume-rejected-alert" id="id139">fastresume_rejected_alert</a></li>
<li><a class="reference internal" href="#peer-blocked-alert" id="id140">peer_blocked_alert</a></li>
<li><a class="reference internal" href="#storage-moved-alert" id="id141">storage_moved_alert</a></li>
<li><a class="reference internal" href="#torrent-paused-alert" id="id142">torrent_paused_alert</a></li>
<li><a class="reference internal" href="#save-resume-data-alert" id="id143">save_resume_data_alert</a></li>
<li><a class="reference internal" href="#dispatcher" id="id144">dispatcher</a></li>
<li><a class="reference internal" href="#tracker-error-alert" id="id127">tracker_error_alert</a></li>
<li><a class="reference internal" href="#tracker-reply-alert" id="id128">tracker_reply_alert</a></li>
<li><a class="reference internal" href="#tracker-warning-alert" id="id129">tracker_warning_alert</a></li>
<li><a class="reference internal" href="#scrape-reply-alert" id="id130">scrape_reply_alert</a></li>
<li><a class="reference internal" href="#scrape-failed-alert" id="id131">scrape_failed_alert</a></li>
<li><a class="reference internal" href="#url-seed-alert" id="id132">url_seed_alert</a></li>
<li><a class="reference internal" href="#hash-failed-alert" id="id133">hash_failed_alert</a></li>
<li><a class="reference internal" href="#peer-ban-alert" id="id134">peer_ban_alert</a></li>
<li><a class="reference internal" href="#peer-error-alert" id="id135">peer_error_alert</a></li>
<li><a class="reference internal" href="#invalid-request-alert" id="id136">invalid_request_alert</a></li>
<li><a class="reference internal" href="#torrent-finished-alert" id="id137">torrent_finished_alert</a></li>
<li><a class="reference internal" href="#metadata-failed-alert" id="id138">metadata_failed_alert</a></li>
<li><a class="reference internal" href="#metadata-received-alert" id="id139">metadata_received_alert</a></li>
<li><a class="reference internal" href="#fastresume-rejected-alert" id="id140">fastresume_rejected_alert</a></li>
<li><a class="reference internal" href="#peer-blocked-alert" id="id141">peer_blocked_alert</a></li>
<li><a class="reference internal" href="#storage-moved-alert" id="id142">storage_moved_alert</a></li>
<li><a class="reference internal" href="#torrent-paused-alert" id="id143">torrent_paused_alert</a></li>
<li><a class="reference internal" href="#save-resume-data-alert" id="id144">save_resume_data_alert</a></li>
<li><a class="reference internal" href="#dispatcher" id="id145">dispatcher</a></li>
</ul>
</li>
<li><a class="reference internal" href="#exceptions" id="id145">exceptions</a><ul>
<li><a class="reference internal" href="#invalid-handle" id="id146">invalid_handle</a></li>
<li><a class="reference internal" href="#duplicate-torrent" id="id147">duplicate_torrent</a></li>
<li><a class="reference internal" href="#invalid-encoding" id="id148">invalid_encoding</a></li>
<li><a class="reference internal" href="#type-error" id="id149">type_error</a></li>
<li><a class="reference internal" href="#invalid-torrent-file" id="id150">invalid_torrent_file</a></li>
<li><a class="reference internal" href="#exceptions" id="id146">exceptions</a><ul>
<li><a class="reference internal" href="#invalid-handle" id="id147">invalid_handle</a></li>
<li><a class="reference internal" href="#duplicate-torrent" id="id148">duplicate_torrent</a></li>
<li><a class="reference internal" href="#invalid-encoding" id="id149">invalid_encoding</a></li>
<li><a class="reference internal" href="#type-error" id="id150">type_error</a></li>
<li><a class="reference internal" href="#invalid-torrent-file" id="id151">invalid_torrent_file</a></li>
</ul>
</li>
<li><a class="reference internal" href="#storage-interface" id="id151">storage_interface</a><ul>
<li><a class="reference internal" href="#initialize" id="id152">initialize()</a></li>
<li><a class="reference internal" href="#read" id="id153">read()</a></li>
<li><a class="reference internal" href="#write" id="id154">write()</a></li>
<li><a class="reference internal" href="#id11" id="id155">move_storage()</a></li>
<li><a class="reference internal" href="#verify-resume-data" id="id156">verify_resume_data()</a></li>
<li><a class="reference internal" href="#write-resume-data" id="id157">write_resume_data()</a></li>
<li><a class="reference internal" href="#move-slot" id="id158">move_slot()</a></li>
<li><a class="reference internal" href="#swap-slots" id="id159">swap_slots()</a></li>
<li><a class="reference internal" href="#swap-slots3" id="id160">swap_slots3()</a></li>
<li><a class="reference internal" href="#hash-for-slot" id="id161">hash_for_slot()</a></li>
<li><a class="reference internal" href="#release-files" id="id162">release_files()</a></li>
<li><a class="reference internal" href="#delete-files" id="id163">delete_files()</a></li>
<li><a class="reference internal" href="#storage-interface" id="id152">storage_interface</a><ul>
<li><a class="reference internal" href="#initialize" id="id153">initialize()</a></li>
<li><a class="reference internal" href="#read" id="id154">read()</a></li>
<li><a class="reference internal" href="#write" id="id155">write()</a></li>
<li><a class="reference internal" href="#id11" id="id156">move_storage()</a></li>
<li><a class="reference internal" href="#verify-resume-data" id="id157">verify_resume_data()</a></li>
<li><a class="reference internal" href="#write-resume-data" id="id158">write_resume_data()</a></li>
<li><a class="reference internal" href="#move-slot" id="id159">move_slot()</a></li>
<li><a class="reference internal" href="#swap-slots" id="id160">swap_slots()</a></li>
<li><a class="reference internal" href="#swap-slots3" id="id161">swap_slots3()</a></li>
<li><a class="reference internal" href="#hash-for-slot" id="id162">hash_for_slot()</a></li>
<li><a class="reference internal" href="#release-files" id="id163">release_files()</a></li>
<li><a class="reference internal" href="#delete-files" id="id164">delete_files()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#fast-resume" id="id164">fast resume</a><ul>
<li><a class="reference internal" href="#file-format" id="id165">file format</a></li>
<li><a class="reference internal" href="#fast-resume" id="id165">fast resume</a><ul>
<li><a class="reference internal" href="#file-format" id="id166">file format</a></li>
</ul>
</li>
<li><a class="reference internal" href="#threads" id="id166">threads</a></li>
<li><a class="reference internal" href="#storage-allocation" id="id167">storage allocation</a><ul>
<li><a class="reference internal" href="#sparse-allocation" id="id168">sparse allocation</a></li>
<li><a class="reference internal" href="#full-allocation" id="id169">full allocation</a></li>
<li><a class="reference internal" href="#compact-allocation" id="id170">compact allocation</a></li>
<li><a class="reference internal" href="#threads" id="id167">threads</a></li>
<li><a class="reference internal" href="#storage-allocation" id="id168">storage allocation</a><ul>
<li><a class="reference internal" href="#sparse-allocation" id="id169">sparse allocation</a></li>
<li><a class="reference internal" href="#full-allocation" id="id170">full allocation</a></li>
<li><a class="reference internal" href="#compact-allocation" id="id171">compact allocation</a></li>
</ul>
</li>
<li><a class="reference internal" href="#extensions" id="id171">extensions</a><ul>
<li><a class="reference internal" href="#metadata-from-peers" id="id172">metadata from peers</a></li>
<li><a class="reference internal" href="#http-seeding" id="id173">HTTP seeding</a></li>
<li><a class="reference internal" href="#extensions" id="id172">extensions</a><ul>
<li><a class="reference internal" href="#metadata-from-peers" id="id173">metadata from peers</a></li>
<li><a class="reference internal" href="#http-seeding" id="id174">HTTP seeding</a></li>
</ul>
</li>
<li><a class="reference internal" href="#filename-checks" id="id174">filename checks</a></li>
<li><a class="reference internal" href="#acknowledgments" id="id175">acknowledgments</a></li>
<li><a class="reference internal" href="#filename-checks" id="id175">filename checks</a></li>
<li><a class="reference internal" href="#acknowledgments" id="id176">acknowledgments</a></li>
</ul>
</div>
<div class="section" id="overview">
@ -335,6 +336,7 @@ class session: public boost::noncopyable
bool load_asnum_db(char const* file);
bool load_country_db(char const* file);
int as_for_ip(address const&amp; adr);
void load_state(entry const&amp; ses_state);
entry state() const;
@ -599,17 +601,20 @@ their turn to get connected.</p>
<p><tt class="docutils literal"><span class="pre">max_half_open_connections()</span></tt> returns the set limit. This limit defaults
to 8 on windows.</p>
</div>
<div class="section" id="load-asnum-db-load-country-db">
<h2>load_asnum_db() load_country_db()</h2>
<div class="section" id="load-asnum-db-load-country-db-int-as-for-ip">
<h2>load_asnum_db() load_country_db() int as_for_ip()</h2>
<blockquote>
<pre class="literal-block">
bool load_asnum_db(char const* file);
bool load_country_db(char const* file);
int as_for_ip(address const&amp; adr);
</pre>
</blockquote>
<p>These functions are not available if <tt class="docutils literal"><span class="pre">TORRENT_DISABLE_GEO_IP</span></tt> is defined. They
expects a path to the <a class="reference external" href="http://www.maxmind.com/app/asnum">MaxMind ASN database</a> and <a class="reference external" href="http://www.maxmind.com/app/geolitecountry">MaxMind GeoIP database</a>
respectively. This will be used to look up which AS and country peers belong to.</p>
<p><tt class="docutils literal"><span class="pre">as_for_ip</span></tt> returns the AS number for the IP address specified. If the IP is not
in the database or the ASN database is not loaded, 0 is returned.</p>
</div>
<div class="section" id="load-state-state">
<h2>load_state() state()</h2>
@ -3625,6 +3630,21 @@ struct tracker_announce_alert: torrent_alert
</div>
<div class="section" id="tracker-alert">
<h2>tracker_alert</h2>
<p>This is a base class for all alerts related to trackers.</p>
<pre class="literal-block">
struct tracker_alert: torrent_alert
{
tracker_alert(torrent_handle const&amp; h
, std::string const&amp; url
, alert::severity_t s
, std::string const&amp; msg);
std::string url;
};
</pre>
</div>
<div class="section" id="tracker-error-alert">
<h2>tracker_error_alert</h2>
<p>This alert is generated on tracker time outs, premature disconnects, invalid response or
a HTTP response other than &quot;200 OK&quot;. From the alert you can get the handle to the torrent
the tracker belongs to. This alert is generated as severity level <tt class="docutils literal"><span class="pre">warning</span></tt>.</p>
@ -3633,10 +3653,10 @@ the tracker belongs to. This alert is generated as severity level <tt class="doc
authentication, 404 means not found etc. If the tracker timed out, the code will be set
to 0.</p>
<pre class="literal-block">
struct tracker_alert: torrent_alert
struct tracker_error_alert: tracker_alert
{
tracker_alert(torrent_handle const&amp; h, int times, int status
, const std::string&amp; msg);
tracker_error_alert(torrent_handle const&amp; h, int times, int status
, std::string const&amp; url, std::string const&amp; msg);
virtual std::auto_ptr&lt;alert&gt; clone() const;
int times_in_row;
@ -3650,11 +3670,12 @@ struct tracker_alert: torrent_alert
succeeds. It is generated regardless what kind of tracker was used, be it UDP, HTTP or
the DHT. It is generated with severity level <tt class="docutils literal"><span class="pre">info</span></tt>.</p>
<pre class="literal-block">
struct tracker_reply_alert: torrent_alert
struct tracker_reply_alert: tracker_alert
{
tracker_reply_alert(const torrent_handle&amp; h
, int num_peers
, const std::string&amp; msg);
. std::string const&amp; url
, std::string const&amp; msg);
int num_peers;
@ -3671,9 +3692,10 @@ means that the tracker announce was successful, but the tracker has a message to
the client. The message string in the alert will contain the warning message from
the tracker. It is generated with severity level <tt class="docutils literal"><span class="pre">warning</span></tt>.</p>
<pre class="literal-block">
struct tracker_warning_alert: torrent_alert
struct tracker_warning_alert: tracker_alert
{
tracker_warning_alert(torrent_handle const&amp; h
, std::string const&amp; url
, std::string const&amp; msg);
virtual std::auto_ptr&lt;alert&gt; clone() const;
@ -3683,11 +3705,12 @@ struct tracker_warning_alert: torrent_alert
<div class="section" id="scrape-reply-alert">
<h2>scrape_reply_alert</h2>
<pre class="literal-block">
struct scrape_reply_alert: torrent_alert
struct scrape_reply_alert: tracker_alert
{
scrape_reply_alert(torrent_handle const&amp; h
, int incomplete_
, int complete_
, std::string const&amp; url
, std::string const&amp; msg);
int incomplete;
@ -3703,9 +3726,10 @@ may be -1 if the reponse was malformed.</p>
<div class="section" id="scrape-failed-alert">
<h2>scrape_failed_alert</h2>
<pre class="literal-block">
struct scrape_failed_alert: torrent_alert
struct scrape_failed_alert: tracker_alert
{
scrape_failed_alert(torrent_handle const&amp; h
, std::string const&amp; url
, std::string const&amp; msg);
virtual std::auto_ptr&lt;alert&gt; clone() const;

View File

@ -3740,6 +3740,23 @@ It is generated at severity level ``info``.
tracker_alert
-------------
This is a base class for all alerts related to trackers.
::
struct tracker_alert: torrent_alert
{
tracker_alert(torrent_handle const& h
, std::string const& url
, alert::severity_t s
, std::string const& msg);
std::string url;
};
tracker_error_alert
-------------------
This alert is generated on tracker time outs, premature disconnects, invalid response or
a HTTP response other than "200 OK". From the alert you can get the handle to the torrent
the tracker belongs to. This alert is generated as severity level ``warning``.
@ -3751,10 +3768,10 @@ to 0.
::
struct tracker_alert: torrent_alert
struct tracker_error_alert: tracker_alert
{
tracker_alert(torrent_handle const& h, int times, int status
, const std::string& msg);
tracker_error_alert(torrent_handle const& h, int times, int status
, std::string const& url, std::string const& msg);
virtual std::auto_ptr<alert> clone() const;
int times_in_row;
@ -3771,11 +3788,12 @@ the DHT. It is generated with severity level ``info``.
::
struct tracker_reply_alert: torrent_alert
struct tracker_reply_alert: tracker_alert
{
tracker_reply_alert(const torrent_handle& h
, int num_peers
, const std::string& msg);
. std::string const& url
, std::string const& msg);
int num_peers;
@ -3795,9 +3813,10 @@ the tracker. It is generated with severity level ``warning``.
::
struct tracker_warning_alert: torrent_alert
struct tracker_warning_alert: tracker_alert
{
tracker_warning_alert(torrent_handle const& h
, std::string const& url
, std::string const& msg);
virtual std::auto_ptr<alert> clone() const;
@ -3808,11 +3827,12 @@ scrape_reply_alert
::
struct scrape_reply_alert: torrent_alert
struct scrape_reply_alert: tracker_alert
{
scrape_reply_alert(torrent_handle const& h
, int incomplete_
, int complete_
, std::string const& url
, std::string const& msg);
int incomplete;
@ -3830,9 +3850,10 @@ scrape_failed_alert
::
struct scrape_failed_alert: torrent_alert
struct scrape_failed_alert: tracker_alert
{
scrape_failed_alert(torrent_handle const& h
, std::string const& url
, std::string const& msg);
virtual std::auto_ptr<alert> clone() const;

View File

@ -56,39 +56,55 @@ namespace libtorrent
struct TORRENT_EXPORT tracker_alert: torrent_alert
{
tracker_alert(torrent_handle const& h
, std::string const& url_
, alert::severity_t s
, std::string const& msg)
: torrent_alert(h, s, msg)
, url(url_)
{}
std::string url;
};
struct TORRENT_EXPORT tracker_error_alert: tracker_alert
{
tracker_error_alert(torrent_handle const& h
, int times
, int status
, std::string const& url
, std::string const& msg)
: torrent_alert(h, alert::warning, msg)
: tracker_alert(h, url, alert::warning, msg)
, times_in_row(times)
, status_code(status)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new tracker_alert(*this)); }
{ return std::auto_ptr<alert>(new tracker_error_alert(*this)); }
int times_in_row;
int status_code;
};
struct TORRENT_EXPORT tracker_warning_alert: torrent_alert
struct TORRENT_EXPORT tracker_warning_alert: tracker_alert
{
tracker_warning_alert(torrent_handle const& h
, std::string const& url
, std::string const& msg)
: torrent_alert(h, alert::warning, msg)
: tracker_alert(h, url, alert::warning, msg)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new tracker_warning_alert(*this)); }
};
struct TORRENT_EXPORT scrape_reply_alert: torrent_alert
struct TORRENT_EXPORT scrape_reply_alert: tracker_alert
{
scrape_reply_alert(torrent_handle const& h
, int incomplete_
, int complete_
, std::string const& url
, std::string const& msg)
: torrent_alert(h, alert::info, msg)
: tracker_alert(h, url, alert::info, msg)
, incomplete(incomplete_)
, complete(complete_)
{}
@ -100,23 +116,25 @@ namespace libtorrent
{ return std::auto_ptr<alert>(new scrape_reply_alert(*this)); }
};
struct TORRENT_EXPORT scrape_failed_alert: torrent_alert
struct TORRENT_EXPORT scrape_failed_alert: tracker_alert
{
scrape_failed_alert(torrent_handle const& h
, std::string const& url
, std::string const& msg)
: torrent_alert(h, alert::warning, msg)
: tracker_alert(h, url, alert::warning, msg)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new scrape_failed_alert(*this)); }
};
struct TORRENT_EXPORT tracker_reply_alert: torrent_alert
struct TORRENT_EXPORT tracker_reply_alert: tracker_alert
{
tracker_reply_alert(torrent_handle const& h
, int np
, std::string const& url
, std::string const& msg)
: torrent_alert(h, alert::info, msg)
: tracker_alert(h, url, alert::info, msg)
, num_peers(np)
{}
@ -126,10 +144,12 @@ namespace libtorrent
{ return std::auto_ptr<alert>(new tracker_reply_alert(*this)); }
};
struct TORRENT_EXPORT tracker_announce_alert: torrent_alert
struct TORRENT_EXPORT tracker_announce_alert: tracker_alert
{
tracker_announce_alert(torrent_handle const& h, std::string const& msg)
: torrent_alert(h, alert::info, msg)
tracker_announce_alert(torrent_handle const& h
, std::string const& url
, std::string const& msg)
: tracker_alert(h, url, alert::info, msg)
{}
virtual std::auto_ptr<alert> clone() const

View File

@ -318,7 +318,8 @@ namespace libtorrent
tracker_request const& r);
virtual void tracker_request_error(tracker_request const& r
, int response_code, const std::string& str);
virtual void tracker_warning(std::string const& msg);
virtual void tracker_warning(tracker_request const& req
, std::string const& msg);
virtual void tracker_scrape_response(tracker_request const& req
, int complete, int incomplete, int downloaded);

View File

@ -118,20 +118,21 @@ namespace libtorrent
friend class tracker_manager;
request_callback(): m_manager(0) {}
virtual ~request_callback() {}
virtual void tracker_warning(std::string const& msg) = 0;
virtual void tracker_warning(tracker_request const& req
, std::string const& msg) = 0;
virtual void tracker_scrape_response(tracker_request const& req
, int complete, int incomplete, int downloads) {}
virtual void tracker_response(
tracker_request const&
tracker_request const& req
, std::vector<peer_entry>& peers
, int interval
, int complete
, int incomplete
, address const& external_ip) = 0;
virtual void tracker_request_timed_out(
tracker_request const&) = 0;
tracker_request const& req) = 0;
virtual void tracker_request_error(
tracker_request const&
tracker_request const& req
, int response_code
, const std::string& description) = 0;

View File

@ -306,7 +306,7 @@ namespace libtorrent
entry const* warning = e.find_key("warning message");
if (warning && warning->type() == entry::string_t)
{
cb->tracker_warning(warning->string());
cb->tracker_warning(tracker_req(), warning->string());
}
std::vector<peer_entry> peer_list;

View File

@ -1035,7 +1035,7 @@ namespace aux {
{
m_alerts.post_alert(
tracker_announce_alert(
t.get_handle(), "tracker announce"));
t.get_handle(), req.url, "tracker announce"));
}
}
@ -1672,7 +1672,7 @@ namespace aux {
{
m_alerts.post_alert(
tracker_announce_alert(
t.get_handle(), "tracker announce, event=stopped"));
t.get_handle(), req.url, "tracker announce, event=stopped"));
}
}
#ifndef NDEBUG

View File

@ -727,7 +727,7 @@ namespace libtorrent
if (m_ses.m_alerts.should_post(alert::info))
{
m_ses.m_alerts.post_alert(tracker_reply_alert(
get_handle(), peers.size(), "Got peers from DHT"));
get_handle(), peers.size(), "DHT", "Got peers from DHT"));
}
std::for_each(peers.begin(), peers.end(), bind(
&policy::peer_from_tracker, boost::ref(m_policy), _1, peer_id(0)
@ -767,7 +767,7 @@ namespace libtorrent
return !m_paused && m_next_request < time_now();
}
void torrent::tracker_warning(std::string const& msg)
void torrent::tracker_warning(tracker_request const& req, std::string const& msg)
{
session_impl::mutex_t::scoped_lock l(m_ses.m_mutex);
@ -775,7 +775,7 @@ namespace libtorrent
if (m_ses.m_alerts.should_post(alert::warning))
{
m_ses.m_alerts.post_alert(tracker_warning_alert(get_handle(), msg));
m_ses.m_alerts.post_alert(tracker_warning_alert(get_handle(), req.url, msg));
}
}
@ -792,10 +792,8 @@ namespace libtorrent
if (m_ses.m_alerts.should_post(alert::info))
{
std::stringstream s;
s << "Got scrape response from tracker: " << req.url;
m_ses.m_alerts.post_alert(scrape_reply_alert(
get_handle(), m_incomplete, m_complete, s.str()));
get_handle(), m_incomplete, m_complete, req.url, "got scrape response from tracker"));
}
}
@ -891,10 +889,8 @@ namespace libtorrent
if (m_ses.m_alerts.should_post(alert::info))
{
std::stringstream s;
s << "Got response from tracker: " << r.url;
m_ses.m_alerts.post_alert(tracker_reply_alert(
get_handle(), peer_list.size(), s.str()));
get_handle(), peer_list.size(), r.url, "got response from tracker"));
}
m_got_tracker_response = true;
}
@ -3740,16 +3736,14 @@ namespace libtorrent
if (m_ses.m_alerts.should_post(alert::warning))
{
std::stringstream s;
s << "tracker: \"" << r.url << "\" timed out";
if (r.kind == tracker_request::announce_request)
{
m_ses.m_alerts.post_alert(tracker_alert(get_handle()
, m_failed_trackers + 1, 0, s.str()));
m_ses.m_alerts.post_alert(tracker_error_alert(get_handle()
, m_failed_trackers + 1, 0, r.url, "tracker timed out"));
}
else if (r.kind == tracker_request::scrape_request)
{
m_ses.m_alerts.post_alert(scrape_failed_alert(get_handle(), s.str()));
m_ses.m_alerts.post_alert(scrape_failed_alert(get_handle(), r.url, "tracker timed out"));
}
}
@ -3772,16 +3766,14 @@ namespace libtorrent
#endif
if (m_ses.m_alerts.should_post(alert::warning))
{
std::stringstream s;
s << "tracker: \"" << r.url << "\" " << str;
if (r.kind == tracker_request::announce_request)
{
m_ses.m_alerts.post_alert(tracker_alert(get_handle()
, m_failed_trackers + 1, response_code, s.str()));
m_ses.m_alerts.post_alert(tracker_error_alert(get_handle()
, m_failed_trackers + 1, response_code, r.url, str));
}
else if (r.kind == tracker_request::scrape_request)
{
m_ses.m_alerts.post_alert(scrape_failed_alert(get_handle(), s.str()));
m_ses.m_alerts.post_alert(scrape_failed_alert(get_handle(), r.url, str));
}
}

View File

@ -144,7 +144,7 @@ namespace libtorrent
{
std::string tracker_address_type = target_address.address().is_v4() ? "IPv4" : "IPv6";
std::string bind_address_type = bind_interface().is_v4() ? "IPv4" : "IPv6";
cb->tracker_warning("the tracker only resolves to an "
cb->tracker_warning(tracker_req(), "the tracker only resolves to an "
+ tracker_address_type + " address, and you're listening on an "
+ bind_address_type + " socket. This may prevent you from receiving incoming connections.");
}