<p>The <aclass="reference external"href="reference-Session.html#pop_alert()">pop_alert()</a> function on <aclass="reference external"href="reference-Session.html#session">session</a> is the interface for retrieving
alerts, warnings, messages and errors from libtorrent. If no alerts have
been posted by libtorrent <aclass="reference external"href="reference-Session.html#pop_alert()">pop_alert()</a> will return a default initialized
<ttclass="docutils literal"><spanclass="pre">std::auto_ptr</span></tt> object. If there is an <aclass="reference external"href="reference-Alerts.html#alert">alert</a> in libtorrent's queue, the <aclass="reference external"href="reference-Alerts.html#alert">alert</a>
from the front of the queue is popped and returned.
You can then use the <aclass="reference external"href="reference-Alerts.html#alert">alert</a> object and query</p>
<p>By default, only errors are reported. <aclass="reference external"href="reference-Session.html#set_alert_mask()">set_alert_mask()</a> can be
used to specify which kinds of events should be reported. The <aclass="reference external"href="reference-Alerts.html#alert">alert</a> mask
is comprised by bits from the <aclass="reference external"href="reference-Alerts.html#category_t">category_t</a> enum.</p>
<p>Every <aclass="reference external"href="reference-Alerts.html#alert">alert</a> belongs to one or more category. There is a small cost involved in posting alerts. Only
alerts that belong to an enabled category are posted. Setting the <aclass="reference external"href="reference-Alerts.html#alert">alert</a> bitmask to 0 will disable
all alerts (except those that are non-discardable).</p>
<p>There are other <aclass="reference external"href="reference-Alerts.html#alert">alert</a> base classes that some alerts derive from, all the
alerts that are generated for a specific torrent are derived from <aclass="reference external"href="reference-Alerts.html#torrent_alert">torrent_alert</a>,
and tracker events derive from <aclass="reference external"href="reference-Alerts.html#tracker_alert">tracker_alert</a>.</p>
<aname="alert"></a><divclass="section"id="alert">
<h1>alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert.hpp">libtorrent/alert.hpp</a>"</p>
<p>The <ttclass="docutils literal">alert</tt> class is the base class that specific messages are derived from.</p>
<p>a timestamp is automatically created in the constructor</p>
<aname="type()"></a></div>
<divclass="section"id="type">
<h2>type()</h2>
<preclass="literal-block">
virtual int <strong>type</strong> () const = 0;
</pre>
<p>returns an integer that is unique to this <aclass="reference external"href="reference-Alerts.html#alert">alert</a> type. It can be
compared against a specific <aclass="reference external"href="reference-Alerts.html#alert">alert</a> by querying a static constant called <ttclass="docutils literal">alert_type</tt>
in the <aclass="reference external"href="reference-Alerts.html#alert">alert</a>. It can be used to determine the run-time type of an alert* in
order to cast to that <aclass="reference external"href="reference-Alerts.html#alert">alert</a> type and access specific members.</p>
<p>determines whether or not an <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is allowed to be discarded
when the <aclass="reference external"href="reference-Alerts.html#alert">alert</a> queue is full. There are a few alerts which may not be discared,
since they would break the user contract, such as <aclass="reference external"href="reference-Alerts.html#save_resume_data_alert">save_resume_data_alert</a>.</p>
<p>returns a pointer to a copy of the <aclass="reference external"href="reference-Alerts.html#alert">alert</a>.</p>
<aname="category_t"></a></div>
<divclass="section"id="enum-category-t">
<h2>enum category_t</h2>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert.hpp">libtorrent/alert.hpp</a>"</p>
<tableborder="1"class="docutils">
<colgroup>
<colwidth="25%"/>
<colwidth="11%"/>
<colwidth="64%"/>
</colgroup>
<theadvalign="bottom">
<tr><thclass="head">name</th>
<thclass="head">value</th>
<thclass="head">description</th>
</tr>
</thead>
<tbodyvalign="top">
<tr><td>error_notification</td>
<td>1</td>
<td><pclass="first">Enables alerts that report an error. This includes:</p>
<ulclass="last simple">
<li>tracker errors</li>
<li>tracker warnings</li>
<li>file errors</li>
<li>resume data failures</li>
<li>web seed errors</li>
<li>.torrent files errors</li>
<li>listen socket errors</li>
<li>port mapping errors</li>
</ul>
</td>
</tr>
<tr><td>peer_notification</td>
<td>2</td>
<td>Enables alerts when peers send invalid requests, get banned or
snubbed.</td>
</tr>
<tr><td>port_mapping_notification</td>
<td>4</td>
<td>Enables alerts for port mapping events. For NAT-PMP and UPnP.</td>
</tr>
<tr><td>storage_notification</td>
<td>8</td>
<td>Enables alerts for events related to the storage. File errors and
synchronization events for moving the storage, renaming files etc.</td>
</tr>
<tr><td>tracker_notification</td>
<td>16</td>
<td>Enables all tracker events. Includes announcing to trackers,
receiving responses, warnings and errors.</td>
</tr>
<tr><td>debug_notification</td>
<td>32</td>
<td>Low level alerts for when peers are connected and disconnected.</td>
</tr>
<tr><td>status_notification</td>
<td>64</td>
<td>Enables alerts for when a torrent or the <aclass="reference external"href="reference-Session.html#session">session</a> changes state.</td>
</tr>
<tr><td>progress_notification</td>
<td>128</td>
<td>Alerts for when blocks are requested and completed. Also when
pieces are completed.</td>
</tr>
<tr><td>ip_block_notification</td>
<td>256</td>
<td>Alerts when a peer is blocked by the ip blocker or port blocker.</td>
</tr>
<tr><td>performance_warning</td>
<td>512</td>
<td>Alerts when some limit is reached that might limit the download
or upload rate.</td>
</tr>
<tr><td>dht_notification</td>
<td>1024</td>
<td>Alerts on events in the DHT node. For incoming searches or
bootstrapping being done etc.</td>
</tr>
<tr><td>stats_notification</td>
<td>2048</td>
<td>If you enable these alerts, you will receive a <aclass="reference external"href="reference-Alerts.html#stats_alert">stats_alert</a>
approximately once every second, for every active torrent.
These alerts contain all statistics counters for the interval since
the lasts stats <aclass="reference external"href="reference-Alerts.html#alert">alert</a>.</td>
</tr>
<tr><td>rss_notification</td>
<td>4096</td>
<td>Alerts on RSS related events, like feeds being updated, feed error
conditions and successful RSS feed updates. Enabling this categoty
will make you receive <aclass="reference external"href="reference-Alerts.html#rss_alert">rss_alert</a> alerts.</td>
</tr>
<tr><td>all_categories</td>
<td>2147483647</td>
<td><pclass="first">The full bitmask, representing all available categories.</p>
<pclass="last">since the enum is signed, make sure this isn't
interpreted as -1. For instance, boost.python
does that and fails when assigning it to an
unsigned parameter.</p>
</td>
</tr>
</tbody>
</table>
<aname="torrent_alert"></a></div>
</div>
<divclass="section"id="torrent-alert">
<h1>torrent_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This is a base class for alerts that are associated with a
specific torrent. It contains a handle to the torrent.</p>
<preclass="literal-block">
struct torrent_alert: alert
{
torrent_handle handle;
};
</pre>
<aname="handle"></a><dlclass="docutils">
<dt>handle</dt>
<dd>The <aclass="reference external"href="reference-Core.html#torrent_handle">torrent_handle</a> pointing to the torrent this
<aclass="reference external"href="reference-Alerts.html#alert">alert</a> is associated with.</dd>
</dl>
<aname="peer_alert"></a></div>
<divclass="section"id="peer-alert">
<h1>peer_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>The peer <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is a base class for alerts that refer to a specific peer. It includes all
the information to identify the peer. i.e. <ttclass="docutils literal">ip</tt> and <ttclass="docutils literal"><spanclass="pre">peer-id</span></tt>.</p>
const static int static_category = alert::status_notification;
sha1_hash info_hash;
};
</pre>
<aname="read_piece_alert"></a></div>
<divclass="section"id="read-piece-alert">
<h1>read_piece_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is posted when the asynchronous read operation initiated by
a call to <aclass="reference external"href="reference-Core.html#read_piece()">torrent_handle::read_piece()</a> is completed. If the read failed, the torrent
is paused and an error state is set and the buffer member of the <aclass="reference external"href="reference-Alerts.html#alert">alert</a>
is 0. If successful, <ttclass="docutils literal">buffer</tt> points to a buffer containing all the data
of the piece. <ttclass="docutils literal">piece</tt> is the piece index that was read. <ttclass="docutils literal">size</tt> is the
number of bytes that was read.</p>
<p>If the operation fails, ec will indicat what went wrong.</p>
const static int static_category = alert::progress_notification;
int index;
};
</pre>
<aname="index"></a><dlclass="docutils">
<dt>index</dt>
<dd>refers to the index of the file that completed.</dd>
</dl>
<aname="file_renamed_alert"></a></div>
<divclass="section"id="file-renamed-alert">
<h1>file_renamed_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This is posted as a response to a <aclass="reference external"href="reference-Core.html#rename_file()">torrent_handle::rename_file()</a> call, if the rename
const static int static_category = alert::storage_notification;
std::string name;
int index;
};
</pre>
<aname="index"></a><dlclass="docutils">
<dt>index</dt>
<dd>refers to the index of the file that was renamed,
<ttclass="docutils literal">name</tt> is the new name of the file.</dd>
</dl>
<aname="file_rename_failed_alert"></a></div>
<divclass="section"id="file-rename-failed-alert">
<h1>file_rename_failed_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This is posted as a response to a <aclass="reference external"href="reference-Core.html#rename_file()">torrent_handle::rename_file()</a> call, if the rename
const static int static_category = alert::storage_notification;
int index;
error_code error;
};
</pre>
<aname="index"></a>
<aname="error"></a><dlclass="docutils">
<dt>index error</dt>
<dd>refers to the index of the file that was supposed to be renamed,
<ttclass="docutils literal">error</tt> is the error code returned from the filesystem.</dd>
</dl>
<aname="performance_alert"></a></div>
<divclass="section"id="performance-alert">
<h1>performance_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated when a limit is reached that might have a negative impact on
<pclass="last">If you receive this <aclass="reference external"href="reference-Alerts.html#alert">alert</a>, you migth want to either increase your <ttclass="docutils literal">send_buffer_watermark</tt>
or <ttclass="docutils literal">send_buffer_watermark_factor</tt>.</p>
</td>
</tr>
<tr><td>too_many_optimistic_unchoke_slots</td>
<td>5</td>
<td>If the half (or more) of all upload slots are set as optimistic unchoke slots, this
warning is issued. You probably want more regular (rate based) unchoke slots.</td>
</tr>
<tr><td>too_high_disk_queue_limit</td>
<td>6</td>
<td>If the disk write queue ever grows larger than half of the cache size, this warning
is posted. The disk write queue eats into the total disk cache and leaves very little
left for the actual cache. This causes the disk cache to oscillate in evicting large
portions of the cache before allowing peers to download any more, onto the disk write
queue. Either lower <ttclass="docutils literal">max_queued_disk_bytes</tt> or increase <ttclass="docutils literal">cache_size</tt>.</td>
</tr>
<tr><td>bittyrant_with_no_uplimit</td>
<td>7</td>
<td> </td>
</tr>
<tr><td>too_few_outgoing_ports</td>
<td>8</td>
<td>This is generated if outgoing peer connections are failing because of <em>address in use</em>
errors, indicating that <ttclass="docutils literal"><spanclass="pre">session_settings::outgoing_ports</span></tt> is set and is too small of
a range. Consider not using the <ttclass="docutils literal">outgoing_ports</tt> setting at all, or widen the range to
include more ports.</td>
</tr>
<tr><td>too_few_file_descriptors</td>
<td>9</td>
<td> </td>
</tr>
<tr><td>num_warnings</td>
<td>10</td>
<td> </td>
</tr>
</tbody>
</table>
<aname="state_changed_alert"></a></div>
</div>
<divclass="section"id="state-changed-alert">
<h1>state_changed_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>Generated whenever a torrent changes its state.</p>
const static int static_category = alert::status_notification;
torrent_status::state_t state;
torrent_status::state_t prev_state;
};
</pre>
<aname="state"></a><dlclass="docutils">
<dt>state</dt>
<dd>the new state of the torrent.</dd>
</dl>
<aname="prev_state"></a><dlclass="docutils">
<dt>prev_state</dt>
<dd>the previous state.</dd>
</dl>
<aname="tracker_error_alert"></a></div>
<divclass="section"id="tracker-error-alert">
<h1>tracker_error_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated on tracker time outs, premature disconnects, invalid response or
a HTTP response other than "200 OK". From the <aclass="reference external"href="reference-Alerts.html#alert">alert</a> you can get the handle to the torrent
the tracker belongs to.</p>
<p>The <ttclass="docutils literal">times_in_row</tt> member says how many times in a row this tracker has failed.
<ttclass="docutils literal">status_code</tt> is the code returned from the HTTP server. 401 means the tracker needs
authentication, 404 means not found etc. If the tracker timed out, the code will be set
const static int static_category = alert::tracker_notification | alert::error_notification;
int times_in_row;
int status_code;
error_code error;
std::string msg;
};
</pre>
<aname="tracker_warning_alert"></a></div>
<divclass="section"id="tracker-warning-alert">
<h1>tracker_warning_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is triggered if the tracker reply contains a warning field. Usually this
means that the tracker announce was successful, but the tracker has a message to
const static int static_category = alert::tracker_notification | alert::error_notification;
std::string msg;
};
</pre>
<aname="msg"></a><dlclass="docutils">
<dt>msg</dt>
<dd>contains a message describing the error.</dd>
</dl>
<aname="tracker_reply_alert"></a></div>
<divclass="section"id="tracker-reply-alert">
<h1>tracker_reply_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is only for informational purpose. It is generated when a tracker announce
succeeds. It is generated regardless what kind of tracker was used, be it UDP, HTTP or
<dd>tells how many peers the tracker returned in this response. This is
not expected to be more thant the <ttclass="docutils literal">num_want</tt> settings. These are not necessarily
all new peers, some of them may already be connected.</dd>
</dl>
<aname="dht_reply_alert"></a></div>
<divclass="section"id="dht-reply-alert">
<h1>dht_reply_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated each time the DHT receives peers from a node. <ttclass="docutils literal">num_peers</tt>
is the number of peers we received in this packet. Typically these packets are
received from multiple DHT nodes, and so the alerts are typically generated
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated each time a tracker announce is sent (or attempted to be sent).
There are no extra data members in this <aclass="reference external"href="reference-Alerts.html#alert">alert</a>. The url can be found in the base class
<dd><pclass="first">specifies what event was sent to the tracker. It is defined as:</p>
<olclass="last arabic simple"start="0">
<li>None</li>
<li>Completed</li>
<li>Started</li>
<li>Stopped</li>
</ol>
</dd>
</dl>
<aname="hash_failed_alert"></a></div>
<divclass="section"id="hash-failed-alert">
<h1>hash_failed_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated when a finished piece fails its hash check. You can get the handle
to the torrent which got the failed piece and the index of the piece itself from the <aclass="reference external"href="reference-Alerts.html#alert">alert</a>.</p>
const static int static_category = alert::status_notification;
int piece_index;
};
</pre>
<aname="peer_ban_alert"></a></div>
<divclass="section"id="peer-ban-alert">
<h1>peer_ban_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated when a peer is banned because it has sent too many corrupt pieces
to us. <ttclass="docutils literal">ip</tt> is the endpoint to the peer that was banned.</p>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated when a peer is unsnubbed. Essentially when it was snubbed for stalling
sending data, and now it started sending data again.</p>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated when a peer is snubbed, when it stops sending data when we request
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated when a peer sends invalid data over the peer-peer protocol. The peer
will be disconnected, but you get its ip address from the <aclass="reference external"href="reference-Alerts.html#alert">alert</a>, to identify it.</p>
const static int static_category = alert::debug_notification;
int socket_type;
};
</pre>
<aname="peer_disconnected_alert"></a></div>
<divclass="section"id="peer-disconnected-alert">
<h1>peer_disconnected_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated when a peer is disconnected for any reason (other than the ones
covered by <aclass="reference external"href="reference-Alerts.html#peer_error_alert">peer_error_alert</a> ).</p>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated when a torrent switches from being a downloader to a seed.
It will only be generated once per torrent. It contains a <aclass="reference external"href="reference-Core.html#torrent_handle">torrent_handle</a> to the
const static int static_category = alert::status_notification;
};
</pre>
<aname="piece_finished_alert"></a></div>
<divclass="section"id="piece-finished-alert">
<h1>piece_finished_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>this <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is posted every time a piece completes downloading
and passes the hash check. This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> derives from <aclass="reference external"href="reference-Alerts.html#torrent_alert">torrent_alert</a>
which contains the <aclass="reference external"href="reference-Core.html#torrent_handle">torrent_handle</a> to the torrent the piece belongs to.</p>
const static int static_category = alert::storage_notification;
error_code error;
};
</pre>
<aname="torrent_deleted_alert"></a></div>
<divclass="section"id="torrent-deleted-alert">
<h1>torrent_deleted_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated when a request to delete the files of a torrent complete.</p>
<p>The <ttclass="docutils literal">info_hash</tt> is the info-hash of the torrent that was just deleted. Most of
the time the <aclass="reference external"href="reference-Core.html#torrent_handle">torrent_handle</a> in the <ttclass="docutils literal">torrent_alert</tt> will be invalid by the time
this <aclass="reference external"href="reference-Alerts.html#alert">alert</a> arrives, since the torrent is being deleted. The <ttclass="docutils literal">info_hash</tt> member
is hence the main way of identifying which torrent just completed the delete.</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is posted in the <ttclass="docutils literal">storage_notification</tt> category, and that bit
<dd>the info hash of the torrent whose files failed to be deleted</dd>
</dl>
<aname="save_resume_data_alert"></a></div>
<divclass="section"id="save-resume-data-alert">
<h1>save_resume_data_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated as a response to a <ttclass="docutils literal"><spanclass="pre">torrent_handle::save_resume_data</span></tt> request.
It is generated once the disk IO thread is done writing the state for this torrent.</p>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated instead of <ttclass="docutils literal">save_resume_data_alert</tt> if there was an error
generating the resume data. <ttclass="docutils literal">error</tt> describes what went wrong.</p>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated as a response to a <ttclass="docutils literal"><spanclass="pre">torrent_handle::pause</span></tt> request. It is
generated once all disk IO is complete and the files in the torrent have been closed.
This is useful for synchronizing with the disk.</p>
const static int static_category = alert::status_notification;
};
</pre>
<aname="torrent_resumed_alert"></a></div>
<divclass="section"id="torrent-resumed-alert">
<h1>torrent_resumed_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated as a response to a <aclass="reference external"href="reference-Core.html#resume()">torrent_handle::resume()</a> request. It is
generated when a torrent goes from a paused state to an active state.</p>
const static int static_category = alert::peer_notification | alert::error_notification;
std::string url;
std::string msg;
};
</pre>
<aname="url"></a><dlclass="docutils">
<dt>url</dt>
<dd>the HTTP seed that failed</dd>
</dl>
<aname="msg"></a><dlclass="docutils">
<dt>msg</dt>
<dd>the error message, potentially from the server</dd>
</dl>
<aname="file_error_alert"></a></div>
<divclass="section"id="file-error-alert">
<h1>file_error_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>If the storage fails to read or write files that it needs access to, this <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is
<dd>the path to the file that was accessed when the error occurred.</dd>
</dl>
<aname="error"></a><dlclass="docutils">
<dt>error</dt>
<dd>the error code describing the error.</dd>
</dl>
<aname="metadata_failed_alert"></a></div>
<divclass="section"id="metadata-failed-alert">
<h1>metadata_failed_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated when the metadata has been completely received and the info-hash
failed to match it. i.e. the metadata that was received was corrupt. libtorrent will
automatically retry to fetch it in this case. This is only relevant when running a
torrent-less download, with the metadata extension provided by libtorrent.</p>
const static int static_category = alert::error_notification;
error_code error;
};
</pre>
<aname="error"></a><dlclass="docutils">
<dt>error</dt>
<dd>the error that occurred</dd>
</dl>
<aname="metadata_received_alert"></a></div>
<divclass="section"id="metadata-received-alert">
<h1>metadata_received_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated when the metadata has been completely received and the torrent
can start downloading. It is not generated on torrents that are started with metadata, but
only those that needs to download it from peers (when utilizing the libtorrent extension).</p>
<p>There are no additional data members in this <aclass="reference external"href="reference-Alerts.html#alert">alert</a>.</p>
<p>Typically, when receiving this <aclass="reference external"href="reference-Alerts.html#alert">alert</a>, you would want to save the torrent file in order
to load it back up again when the <aclass="reference external"href="reference-Session.html#session">session</a> is restarted. Here's an example snippet of
code to do that:</p>
<preclass="literal-block">
torrent_handle h = alert->handle();
if (h.is_valid()) {
boost::intrusive_ptr<torrent_info const> ti = h.torrent_file();
create_torrent ct(*ti);
entry te = ct.generate();
std::vector<char> buffer;
bencode(std::back_inserter(buffer), te);
FILE* f = fopen((to_hex(ti->info_hash().to_string()) + ".torrent").c_str(), "wb+");
<dd>the IP address that is believed to be our external IP</dd>
</dl>
<aname="listen_failed_alert"></a></div>
<divclass="section"id="listen-failed-alert">
<h1>listen_failed_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated when none of the ports, given in the port range, to
<aclass="reference external"href="reference-Session.html#session">session</a> can be opened for listening. The <ttclass="docutils literal">endpoint</tt> member is the
interface and port that failed, <ttclass="docutils literal">error</tt> is the error code describing
the failure.</p>
<p>libtorrent may sometimes try to listen on port 0, if all other ports failed.
Port 0 asks the operating system to pick a port that's free). If that fails
you may see a <aclass="reference external"href="reference-Alerts.html#listen_failed_alert">listen_failed_alert</a> with port 0 even if you didn't ask to
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated when a fastresume file has been passed to <aclass="reference external"href="reference-Session.html#add_torrent()">add_torrent()</a> but the
files on disk did not match the fastresume file. The error_code explains the reason why the
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is posted when an incoming peer connection, or a peer that's about to be added
to our peer list, is blocked for some reason. This could be any of:</p>
<ulclass="simple">
<li>the IP filter</li>
<li>i2p mixed mode restrictions (a normal peer is not allowed on an i2p swarm)</li>
<li>the port filter</li>
<li>the peer has a low port and <ttclass="docutils literal">no_connect_privileged_ports</tt> is enabled</li>
<li>the protocol of the peer is blocked (uTP/TCP blocking)</li>
const static int static_category = alert::ip_block_notification;
address ip;
};
</pre>
<aname="ip"></a><dlclass="docutils">
<dt>ip</dt>
<dd>the address that was blocked.</dd>
</dl>
<aname="dht_announce_alert"></a></div>
<divclass="section"id="dht-announce-alert">
<h1>dht_announce_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated when a DHT node announces to an info-hash on our DHT node. It belongs
to the <ttclass="docutils literal">dht_notification</tt> category.</p>
const static int static_category = alert::dht_notification;
address ip;
int port;
sha1_hash info_hash;
};
</pre>
<aname="dht_get_peers_alert"></a></div>
<divclass="section"id="dht-get-peers-alert">
<h1>dht_get_peers_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated when a DHT node sends a <ttclass="docutils literal">get_peers</tt> message to our DHT node.
It belongs to the <ttclass="docutils literal">dht_notification</tt> category.</p>
<dd>an array of samples. The enum describes what each
sample is a measurement of. All of these are raw, and not smoothing is performed.</dd>
</dl>
<aname="interval"></a><dlclass="docutils">
<dt>interval</dt>
<dd>the number of milliseconds during which these stats
were collected. This is typically just above 1000, but if CPU is
limited, it may be higher than that.</dd>
</dl>
<aname="cache_flushed_alert"></a></div>
</div>
<divclass="section"id="cache-flushed-alert">
<h1>cache_flushed_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is posted when the disk cache has been flushed for a specific torrent
as a result of a call to <aclass="reference external"href="reference-Core.html#flush_cache()">torrent_handle::flush_cache()</a>. This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> belongs to the
<ttclass="docutils literal">storage_notification</tt> category, which must be enabled to let this <aclass="reference external"href="reference-Alerts.html#alert">alert</a> through.
The <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is also posted when removing a torrent from the <aclass="reference external"href="reference-Session.html#session">session</a>, once the outstanding
cache flush is complete and the torrent does no longer have any files open.</p>
<preclass="literal-block">
struct cache_flushed_alert: torrent_alert
{
const static int static_category = alert::storage_notification;
};
</pre>
<aname="anonymous_mode_alert"></a></div>
<divclass="section"id="anonymous-mode-alert">
<h1>anonymous_mode_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is posted when a bittorrent feature is blocked because of the
anonymous mode. For instance, if the tracker proxy is not set up, no
trackers will be used, because trackers can only be used through proxies
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<tableborder="1"class="docutils">
<colgroup>
<colwidth="23%"/>
<colwidth="7%"/>
<colwidth="70%"/>
</colgroup>
<theadvalign="bottom">
<tr><thclass="head">name</th>
<thclass="head">value</th>
<thclass="head">description</th>
</tr>
</thead>
<tbodyvalign="top">
<tr><td>tracker_not_anonymous</td>
<td>0</td>
<td>means that there's no proxy set up for tracker
communication and the tracker will not be contacted.
The tracker which this failed for is specified in the <ttclass="docutils literal">str</tt> member.</td>
</tr>
</tbody>
</table>
<aname="kind"></a>
<aname="str"></a><dlclass="docutils">
<dt>kind str</dt>
<dd>specifies what error this is, see <aclass="reference external"href="reference-Alerts.html#kind_t">kind_t</a>.</dd>
</dl>
<aname="lsd_peer_alert"></a></div>
</div>
<divclass="section"id="lsd-peer-alert">
<h1>lsd_peer_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is generated when we receive a local service discovery message from a peer
for a torrent we're currently participating in.</p>
const static int static_category = alert::peer_notification;
};
</pre>
<aname="trackerid_alert"></a></div>
<divclass="section"id="trackerid-alert">
<h1>trackerid_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is posted whenever a tracker responds with a <ttclass="docutils literal">trackerid</tt>. The tracker ID
is like a cookie. The libtorrent will store the tracker ID for this tracker and
const static int static_category = alert::dht_notification;
};
</pre>
<aname="rss_alert"></a></div>
<divclass="section"id="rss-alert">
<h1>rss_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is posted on RSS feed events such as start of RSS feed updates,
successful completed updates and errors during updates.</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is only posted if the <ttclass="docutils literal">rss_notifications</tt> category is enabled
const static int static_category = alert::error_notification | alert::status_notification;
error_code error;
};
</pre>
<aname="error"></a><dlclass="docutils">
<dt>error</dt>
<dd>specifies which error the torrent encountered.</dd>
</dl>
<aname="torrent_need_cert_alert"></a></div>
<divclass="section"id="torrent-need-cert-alert">
<h1>torrent_need_cert_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This is always posted for SSL torrents. This is a reminder to the client that
the torrent won't work unless <aclass="reference external"href="reference-Core.html#set_ssl_certificate()">torrent_handle::set_ssl_certificate()</a> is called with
a valid certificate. Valid certificates MUST be signed by the SSL certificate
const static int static_category = alert::status_notification;
add_torrent_params params;
error_code error;
};
</pre>
<aname="params"></a><dlclass="docutils">
<dt>params</dt>
<dd>a copy of the parameters used when adding the torrent, it can be used
to identify which invocation to <ttclass="docutils literal">async_add_torrent()</tt> caused this <aclass="reference external"href="reference-Alerts.html#alert">alert</a>.</dd>
</dl>
<aname="error"></a><dlclass="docutils">
<dt>error</dt>
<dd>set to the error, if one occurred while adding the torrent.</dd>
</dl>
<aname="state_update_alert"></a></div>
<divclass="section"id="state-update-alert">
<h1>state_update_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is only posted when requested by the user, by calling <aclass="reference external"href="reference-Session.html#post_torrent_updates()">session::post_torrent_updates()</a>
on the <aclass="reference external"href="reference-Session.html#session">session</a>. It contains the torrent status of all torrents that changed
since last time this message was posted. Its category is <ttclass="docutils literal">status_notification</tt>, but
it's not subject to filtering, since it's only manually posted anyway.</p>
const static int static_category = alert::status_notification;
std::vector<torrent_status> status;
};
</pre>
<aname="status"></a><dlclass="docutils">
<dt>status</dt>
<dd>contains the torrent status of all torrents that changed since last time
this message was posted. Note that you can map a torrent status to a specific torrent
via its <ttclass="docutils literal">handle</tt> member. The receiving end is suggested to have all torrents sorted
by the <aclass="reference external"href="reference-Core.html#torrent_handle">torrent_handle</a> or hashed by it, for efficient updates.</dd>
</dl>
<aname="torrent_update_alert"></a></div>
<divclass="section"id="torrent-update-alert">
<h1>torrent_update_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>When a torrent changes its info-hash, this <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is posted. This only happens in very
specific cases. For instance, when a torrent is downloaded from a URL, the true info
hash is not known immediately. First the .torrent file must be downloaded and parsed.</p>
<p>Once this download completes, the <ttclass="docutils literal">torrent_update_alert</tt> is posted to notify the client
const static int static_category = alert::status_notification;
sha1_hash old_ih;
sha1_hash new_ih;
};
</pre>
<aname="old_ih"></a>
<aname="new_ih"></a><dlclass="docutils">
<dt>old_ih new_ih</dt>
<dd><ttclass="docutils literal">old_ih</tt> and <ttclass="docutils literal">new_ih</tt> are the previous and new info-hash for the torrent, respectively.</dd>
</dl>
<aname="rss_item_alert"></a></div>
<divclass="section"id="rss-item-alert">
<h1>rss_item_alert</h1>
<p>Declared in "<aclass="reference external"href="../include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>"</p>
<p>This <aclass="reference external"href="reference-Alerts.html#alert">alert</a> is posted every time a new RSS item (i.e. torrent) is received
from an RSS feed.</p>
<p>It is only posted if the <ttclass="docutils literal">rss_notifications</tt> category is enabled in the