alert_types.hpp   alert_types.hpp 
skipping to change at line 62 skipping to change at line 62
{ {
// user defined alerts should use IDs greater than this // user defined alerts should use IDs greater than this
const static int user_alert_id = 10000; const static int user_alert_id = 10000;
// This is a base class for alerts that are associated with a // This is a base class for alerts that are associated with a
// specific torrent. It contains a handle to the torrent. // specific torrent. It contains a handle to the torrent.
struct TORRENT_EXPORT torrent_alert: alert struct TORRENT_EXPORT torrent_alert: alert
{ {
// internal // internal
torrent_alert(torrent_handle const& h) torrent_alert(torrent_handle const& h);
: handle(h)
{}
// internal // internal
const static int alert_type = 1; const static int alert_type = 1;
virtual std::string message() const; virtual std::string message() const;
// The torrent_handle pointing to the torrent this // The torrent_handle pointing to the torrent this
// alert is associated with. // alert is associated with.
torrent_handle handle; torrent_handle handle;
}; };
// The peer alert is a base class for alerts that refer to a specifi c peer. It includes all // The peer alert is a base class for alerts that refer to a specifi c peer. It includes all
// the information to identify the peer. i.e. ``ip`` and ``peer-id`` . // the information to identify the peer. i.e. ``ip`` and ``peer-id`` .
struct TORRENT_EXPORT peer_alert: torrent_alert struct TORRENT_EXPORT peer_alert: torrent_alert
{ {
// internal // internal
peer_alert(torrent_handle const& h, tcp::endpoint const& i peer_alert(torrent_handle const& h, tcp::endpoint const& i
, peer_id const& pi) , peer_id const& pi);
: torrent_alert(h)
, ip(i)
, pid(pi)
{}
const static int alert_type = 2; const static int alert_type = 2;
const static int static_category = alert::peer_notification; const static int static_category = alert::peer_notification;
virtual int category() const { return static_category; } virtual int category() const { return static_category; }
virtual std::string message() const; virtual std::string message() const;
// The peer's IP address and port. // The peer's IP address and port.
tcp::endpoint ip; tcp::endpoint ip;
// the peer ID, if known. // the peer ID, if known.
peer_id pid; peer_id pid;
}; };
// This is a base class used for alerts that are associated with a // This is a base class used for alerts that are associated with a
// specific tracker. It derives from torrent_alert since a tracker // specific tracker. It derives from torrent_alert since a tracker
// is also associated with a specific torrent. // is also associated with a specific torrent.
struct TORRENT_EXPORT tracker_alert: torrent_alert struct TORRENT_EXPORT tracker_alert: torrent_alert
{ {
// internal // internal
tracker_alert(torrent_handle const& h tracker_alert(torrent_handle const& h
, std::string const& u) , std::string const& u);
: torrent_alert(h)
, url(u)
{}
const static int alert_type = 3; const static int alert_type = 3;
const static int static_category = alert::tracker_notificati on; const static int static_category = alert::tracker_notificati on;
virtual int category() const { return static_category; } virtual int category() const { return static_category; }
virtual std::string message() const; virtual std::string message() const;
// The tracker URL // The tracker URL
std::string url; std::string url;
}; };
skipping to change at line 135 skipping to change at line 126
virtual int category() const { return static_category; } \ virtual int category() const { return static_category; } \
virtual char const* what() const { return #name; } virtual char const* what() const { return #name; }
// The ``torrent_added_alert`` is posted once every time a torrent i s successfully // The ``torrent_added_alert`` is posted once every time a torrent i s successfully
// added. It doesn't contain any members of its own, but inherits th e torrent handle // added. It doesn't contain any members of its own, but inherits th e torrent handle
// from its base class. // from its base class.
// It's posted when the ``status_notification`` bit is set in the al ert_mask. // It's posted when the ``status_notification`` bit is set in the al ert_mask.
struct TORRENT_EXPORT torrent_added_alert: torrent_alert struct TORRENT_EXPORT torrent_added_alert: torrent_alert
{ {
// internal // internal
torrent_added_alert(torrent_handle const& h) torrent_added_alert(torrent_handle const& h);
: torrent_alert(h)
{}
TORRENT_DEFINE_ALERT(torrent_added_alert); TORRENT_DEFINE_ALERT(torrent_added_alert);
const static int static_category = alert::status_notificatio n; const static int static_category = alert::status_notificatio n;
virtual std::string message() const; virtual std::string message() const;
}; };
// The ``torrent_removed_alert`` is posted whenever a torrent is rem oved. Since // The ``torrent_removed_alert`` is posted whenever a torrent is rem oved. Since
// the torrent handle in its baseclass will always be invalid (since the torrent // the torrent handle in its baseclass will always be invalid (since the torrent
// is already removed) it has the info hash as a member, to identify it. // is already removed) it has the info hash as a member, to identify it.
// It's posted when the ``status_notification`` bit is set in the al ert_mask. // It's posted when the ``status_notification`` bit is set in the al ert_mask.
skipping to change at line 159 skipping to change at line 148
// Even though the ``handle`` member doesn't point to an existing to rrent anymore, // Even though the ``handle`` member doesn't point to an existing to rrent anymore,
// it is still useful for comparing to other handles, which may also no // it is still useful for comparing to other handles, which may also no
// longer point to existing torrents, but to the same non-existing t orrents. // longer point to existing torrents, but to the same non-existing t orrents.
// //
// The ``torrent_handle`` acts as a ``weak_ptr``, even though its ob ject no // The ``torrent_handle`` acts as a ``weak_ptr``, even though its ob ject no
// longer exists, it can still compare equal to another weak pointer which // longer exists, it can still compare equal to another weak pointer which
// points to the same non-existent object. // points to the same non-existent object.
struct TORRENT_EXPORT torrent_removed_alert: torrent_alert struct TORRENT_EXPORT torrent_removed_alert: torrent_alert
{ {
// internal // internal
torrent_removed_alert(torrent_handle const& h, sha1_hash con torrent_removed_alert(torrent_handle const& h, sha1_hash con
st& ih) st& ih);
: torrent_alert(h)
, info_hash(ih)
{}
TORRENT_DEFINE_ALERT(torrent_removed_alert); TORRENT_DEFINE_ALERT(torrent_removed_alert);
const static int static_category = alert::status_notificatio n; const static int static_category = alert::status_notificatio n;
virtual std::string message() const; virtual std::string message() const;
sha1_hash info_hash; sha1_hash info_hash;
}; };
// This alert is posted when the asynchronous read operation initiat ed by // This alert is posted when the asynchronous read operation initiat ed by
// a call to torrent_handle::read_piece() is completed. If the read failed, the torrent // a call to torrent_handle::read_piece() is completed. If the read failed, the torrent
// is paused and an error state is set and the buffer member of the alert // is paused and an error state is set and the buffer member of the alert
// is 0. If successful, ``buffer`` points to a buffer containing all the data // is 0. If successful, ``buffer`` points to a buffer containing all the data
// of the piece. ``piece`` is the piece index that was read. ``size` ` is the // of the piece. ``piece`` is the piece index that was read. ``size` ` is the
// number of bytes that was read. // number of bytes that was read.
// //
// If the operation fails, ec will indicat what went wrong. // If the operation fails, ec will indicat what went wrong.
struct TORRENT_EXPORT read_piece_alert: torrent_alert struct TORRENT_EXPORT read_piece_alert: torrent_alert
{ {
// internal // internal
read_piece_alert(torrent_handle const& h read_piece_alert(torrent_handle const& h
, int p, boost::shared_array<char> d, int s) , int p, boost::shared_array<char> d, int s);
: torrent_alert(h) read_piece_alert(torrent_handle h, int p, error_code e);
, buffer(d)
, piece(p)
, size(s)
{}
read_piece_alert(torrent_handle h, int p, error_code e)
: torrent_alert(h)
, ec(e)
, piece(p)
, size(0)
{}
TORRENT_DEFINE_ALERT(read_piece_alert); TORRENT_DEFINE_ALERT(read_piece_alert);
const static int static_category = alert::storage_notificati on; const static int static_category = alert::storage_notificati on;
virtual std::string message() const; virtual std::string message() const;
virtual bool discardable() const { return false; } virtual bool discardable() const { return false; }
error_code ec; error_code ec;
boost::shared_array<char> buffer; boost::shared_array<char> buffer;
int piece; int piece;
int size; int size;
}; };
// This is posted whenever an individual file completes its download . i.e. // This is posted whenever an individual file completes its download . i.e.
// All pieces overlapping this file have passed their hash check. // All pieces overlapping this file have passed their hash check.
struct TORRENT_EXPORT file_completed_alert: torrent_alert struct TORRENT_EXPORT file_completed_alert: torrent_alert
{ {
// internal // internal
file_completed_alert(torrent_handle const& h file_completed_alert(torrent_handle const& h
, int idx) , int idx);
: torrent_alert(h)
, index(idx)
{}
TORRENT_DEFINE_ALERT(file_completed_alert); TORRENT_DEFINE_ALERT(file_completed_alert);
const static int static_category = alert::progress_notificat ion; const static int static_category = alert::progress_notificat ion;
virtual std::string message() const; virtual std::string message() const;
// refers to the index of the file that completed. // refers to the index of the file that completed.
int index; int index;
}; };
// This is posted as a response to a torrent_handle::rename_file() c all, if the rename // This is posted as a response to a torrent_handle::rename_file() c all, if the rename
// operation succeeds. // operation succeeds.
struct TORRENT_EXPORT file_renamed_alert: torrent_alert struct TORRENT_EXPORT file_renamed_alert: torrent_alert
{ {
// internal // internal
file_renamed_alert(torrent_handle const& h file_renamed_alert(torrent_handle const& h
, std::string const& n , std::string const& n
, int idx) , int idx);
: torrent_alert(h)
, name(n)
, index(idx)
{}
TORRENT_DEFINE_ALERT(file_renamed_alert); TORRENT_DEFINE_ALERT(file_renamed_alert);
const static int static_category = alert::storage_notificati on; const static int static_category = alert::storage_notificati on;
virtual std::string message() const; virtual std::string message() const;
virtual bool discardable() const { return false; } virtual bool discardable() const { return false; }
std::string name; std::string name;
// refers to the index of the file that was renamed, // refers to the index of the file that was renamed,
skipping to change at line 260 skipping to change at line 229
int index; int index;
}; };
// This is posted as a response to a torrent_handle::rename_file() c all, if the rename // This is posted as a response to a torrent_handle::rename_file() c all, if the rename
// operation failed. // operation failed.
struct TORRENT_EXPORT file_rename_failed_alert: torrent_alert struct TORRENT_EXPORT file_rename_failed_alert: torrent_alert
{ {
// internal // internal
file_rename_failed_alert(torrent_handle const& h file_rename_failed_alert(torrent_handle const& h
, int idx , int idx
, error_code ec) , error_code ec);
: torrent_alert(h)
, index(idx)
, error(ec)
{}
TORRENT_DEFINE_ALERT(file_rename_failed_alert); TORRENT_DEFINE_ALERT(file_rename_failed_alert);
const static int static_category = alert::storage_notificati on; const static int static_category = alert::storage_notificati on;
virtual std::string message() const; virtual std::string message() const;
virtual bool discardable() const { return false; } virtual bool discardable() const { return false; }
// refers to the index of the file that was supposed to be r enamed, // refers to the index of the file that was supposed to be r enamed,
// ``error`` is the error code returned from the filesystem. // ``error`` is the error code returned from the filesystem.
skipping to change at line 365 skipping to change at line 330
// include more ports. // include more ports.
too_few_outgoing_ports, too_few_outgoing_ports,
too_few_file_descriptors, too_few_file_descriptors,
num_warnings num_warnings
}; };
// internal // internal
performance_alert(torrent_handle const& h performance_alert(torrent_handle const& h
, performance_warning_t w) , performance_warning_t w);
: torrent_alert(h)
, warning_code(w)
{}
TORRENT_DEFINE_ALERT(performance_alert); TORRENT_DEFINE_ALERT(performance_alert);
const static int static_category = alert::performance_warnin g; const static int static_category = alert::performance_warnin g;
virtual std::string message() const; virtual std::string message() const;
performance_warning_t warning_code; performance_warning_t warning_code;
}; };
// Generated whenever a torrent changes its state. // Generated whenever a torrent changes its state.
struct TORRENT_EXPORT state_changed_alert: torrent_alert struct TORRENT_EXPORT state_changed_alert: torrent_alert
{ {
// internal // internal
state_changed_alert(torrent_handle const& h state_changed_alert(torrent_handle const& h
, torrent_status::state_t st , torrent_status::state_t st
, torrent_status::state_t prev_st) , torrent_status::state_t prev_st);
: torrent_alert(h)
, state(st)
, prev_state(prev_st)
{}
TORRENT_DEFINE_ALERT(state_changed_alert); TORRENT_DEFINE_ALERT(state_changed_alert);
const static int static_category = alert::status_notificatio n; const static int static_category = alert::status_notificatio n;
virtual std::string message() const; virtual std::string message() const;
// the new state of the torrent. // the new state of the torrent.
torrent_status::state_t state; torrent_status::state_t state;
skipping to change at line 420 skipping to change at line 378
// means the tracker needs authentication, 404 means not found etc. If the // means the tracker needs authentication, 404 means not found etc. If the
// tracker timed out, the code will be set to 0. // tracker timed out, the code will be set to 0.
struct TORRENT_EXPORT tracker_error_alert: tracker_alert struct TORRENT_EXPORT tracker_error_alert: tracker_alert
{ {
// internal // internal
tracker_error_alert(torrent_handle const& h tracker_error_alert(torrent_handle const& h
, int times , int times
, int status , int status
, std::string const& u , std::string const& u
, error_code const& e , error_code const& e
, std::string const& m) , std::string const& m);
: tracker_alert(h, u)
, times_in_row(times)
, status_code(status)
, error(e)
, msg(m)
{
TORRENT_ASSERT(!url.empty());
}
TORRENT_DEFINE_ALERT(tracker_error_alert); TORRENT_DEFINE_ALERT(tracker_error_alert);
const static int static_category = alert::tracker_notificati on | alert::error_notification; const static int static_category = alert::tracker_notificati on | alert::error_notification;
virtual std::string message() const; virtual std::string message() const;
int times_in_row; int times_in_row;
int status_code; int status_code;
error_code error; error_code error;
std::string msg; std::string msg;
}; };
// This alert is triggered if the tracker reply contains a warning f ield. // This alert is triggered if the tracker reply contains a warning f ield.
// Usually this means that the tracker announce was successful, but the // Usually this means that the tracker announce was successful, but the
// tracker has a message to the client. // tracker has a message to the client.
struct TORRENT_EXPORT tracker_warning_alert: tracker_alert struct TORRENT_EXPORT tracker_warning_alert: tracker_alert
{ {
// internal // internal
tracker_warning_alert(torrent_handle const& h tracker_warning_alert(torrent_handle const& h
, std::string const& u , std::string const& u
, std::string const& m) , std::string const& m);
: tracker_alert(h, u)
, msg(m)
{ TORRENT_ASSERT(!url.empty()); }
TORRENT_DEFINE_ALERT(tracker_warning_alert); TORRENT_DEFINE_ALERT(tracker_warning_alert);
const static int static_category = alert::tracker_notificati on | alert::error_notification; const static int static_category = alert::tracker_notificati on | alert::error_notification;
virtual std::string message() const; virtual std::string message() const;
// contains the warning message from the tracker. // contains the warning message from the tracker.
std::string msg; std::string msg;
}; };
// This alert is generated when a scrape request succeeds. // This alert is generated when a scrape request succeeds.
struct TORRENT_EXPORT scrape_reply_alert: tracker_alert struct TORRENT_EXPORT scrape_reply_alert: tracker_alert
{ {
// internal // internal
scrape_reply_alert(torrent_handle const& h scrape_reply_alert(torrent_handle const& h
, int incomp , int incomp
, int comp , int comp
, std::string const& u) , std::string const& u);
: tracker_alert(h, u)
, incomplete(incomp)
, complete(comp)
{ TORRENT_ASSERT(!url.empty()); }
TORRENT_DEFINE_ALERT(scrape_reply_alert); TORRENT_DEFINE_ALERT(scrape_reply_alert);
virtual std::string message() const; virtual std::string message() const;
// the data returned in the scrape response. These numbers // the data returned in the scrape response. These numbers
// may be -1 if the reponse was malformed. // may be -1 if the reponse was malformed.
int incomplete; int incomplete;
int complete; int complete;
}; };
// If a scrape request fails, this alert is generated. This might be due // If a scrape request fails, this alert is generated. This might be due
// to the tracker timing out, refusing connection or returning an ht tp response // to the tracker timing out, refusing connection or returning an ht tp response
// code indicating an error. // code indicating an error.
struct TORRENT_EXPORT scrape_failed_alert: tracker_alert struct TORRENT_EXPORT scrape_failed_alert: tracker_alert
{ {
// internal // internal
scrape_failed_alert(torrent_handle const& h scrape_failed_alert(torrent_handle const& h
, std::string const& u , std::string const& u
, error_code const& e) , error_code const& e);
: tracker_alert(h, u)
, msg(convert_from_native(e.message()))
{ TORRENT_ASSERT(!url.empty()); }
scrape_failed_alert(torrent_handle const& h scrape_failed_alert(torrent_handle const& h
, std::string const& u , std::string const& u
, std::string const& m) , std::string const& m);
: tracker_alert(h, u)
, msg(m)
{ TORRENT_ASSERT(!url.empty()); }
TORRENT_DEFINE_ALERT(scrape_failed_alert); TORRENT_DEFINE_ALERT(scrape_failed_alert);
const static int static_category = alert::tracker_notificati on | alert::error_notification; const static int static_category = alert::tracker_notificati on | alert::error_notification;
virtual std::string message() const; virtual std::string message() const;
// contains a message describing the error. // contains a message describing the error.
std::string msg; std::string msg;
}; };
// This alert is only for informational purpose. It is generated whe n a tracker announce // This alert is only for informational purpose. It is generated whe n a tracker announce
// succeeds. It is generated regardless what kind of tracker was use d, be it UDP, HTTP or // succeeds. It is generated regardless what kind of tracker was use d, be it UDP, HTTP or
// the DHT. // the DHT.
struct TORRENT_EXPORT tracker_reply_alert: tracker_alert struct TORRENT_EXPORT tracker_reply_alert: tracker_alert
{ {
// internal // internal
tracker_reply_alert(torrent_handle const& h tracker_reply_alert(torrent_handle const& h
, int np , int np
, std::string const& u) , std::string const& u);
: tracker_alert(h, u)
, num_peers(np)
{ TORRENT_ASSERT(!url.empty()); }
TORRENT_DEFINE_ALERT(tracker_reply_alert); TORRENT_DEFINE_ALERT(tracker_reply_alert);
virtual std::string message() const; virtual std::string message() const;
// tells how many peers the tracker returned in this respons e. This is // tells how many peers the tracker returned in this respons e. This is
// not expected to be more thant the ``num_want`` settings. These are not necessarily // not expected to be more thant the ``num_want`` settings. These are not necessarily
// all new peers, some of them may already be connected. // all new peers, some of them may already be connected.
int num_peers; int num_peers;
}; };
// This alert is generated each time the DHT receives peers from a n ode. ``num_peers`` // This alert is generated each time the DHT receives peers from a n ode. ``num_peers``
// is the number of peers we received in this packet. Typically thes e packets are // is the number of peers we received in this packet. Typically thes e packets are
// received from multiple DHT nodes, and so the alerts are typically generated // received from multiple DHT nodes, and so the alerts are typically generated
// a few at a time. // a few at a time.
struct TORRENT_EXPORT dht_reply_alert: tracker_alert struct TORRENT_EXPORT dht_reply_alert: tracker_alert
{ {
// internal // internal
dht_reply_alert(torrent_handle const& h dht_reply_alert(torrent_handle const& h
, int np) , int np);
: tracker_alert(h, "")
, num_peers(np)
{}
TORRENT_DEFINE_ALERT(dht_reply_alert); TORRENT_DEFINE_ALERT(dht_reply_alert);
virtual std::string message() const; virtual std::string message() const;
int num_peers; int num_peers;
}; };
// This alert is generated each time a tracker announce is sent (or attempted to be sent). // This alert is generated each time a tracker announce is sent (or attempted to be sent).
// There are no extra data members in this alert. The url can be fou nd in the base class // There are no extra data members in this alert. The url can be fou nd in the base class
// however. // however.
struct TORRENT_EXPORT tracker_announce_alert: tracker_alert struct TORRENT_EXPORT tracker_announce_alert: tracker_alert
{ {
// internal // internal
tracker_announce_alert(torrent_handle const& h tracker_announce_alert(torrent_handle const& h
, std::string const& u, int e) , std::string const& u, int e);
: tracker_alert(h, u)
, event(e)
{ TORRENT_ASSERT(!url.empty()); }
TORRENT_DEFINE_ALERT(tracker_announce_alert); TORRENT_DEFINE_ALERT(tracker_announce_alert);
virtual std::string message() const; virtual std::string message() const;
// specifies what event was sent to the tracker. It is defin ed as: // specifies what event was sent to the tracker. It is defin ed as:
// //
// 0. None // 0. None
// 1. Completed // 1. Completed
// 2. Started // 2. Started
skipping to change at line 590 skipping to change at line 518
int event; int event;
}; };
// This alert is generated when a finished piece fails its hash chec k. You can get the handle // This alert is generated when a finished piece fails its hash chec k. You can get the handle
// to the torrent which got the failed piece and the index of the pi ece itself from the alert. // to the torrent which got the failed piece and the index of the pi ece itself from the alert.
struct TORRENT_EXPORT hash_failed_alert: torrent_alert struct TORRENT_EXPORT hash_failed_alert: torrent_alert
{ {
// internal // internal
hash_failed_alert( hash_failed_alert(
torrent_handle const& h torrent_handle const& h
, int index) , int index);
: torrent_alert(h)
, piece_index(index)
{ TORRENT_ASSERT(index >= 0);}
TORRENT_DEFINE_ALERT(hash_failed_alert); TORRENT_DEFINE_ALERT(hash_failed_alert);
const static int static_category = alert::status_notificatio n; const static int static_category = alert::status_notificatio n;
virtual std::string message() const; virtual std::string message() const;
int piece_index; int piece_index;
}; };
// This alert is generated when a peer is banned because it has sent too many corrupt pieces // This alert is generated when a peer is banned because it has sent too many corrupt pieces
// to us. ``ip`` is the endpoint to the peer that was banned. // to us. ``ip`` is the endpoint to the peer that was banned.
struct TORRENT_EXPORT peer_ban_alert: peer_alert struct TORRENT_EXPORT peer_ban_alert: peer_alert
{ {
// internal // internal
peer_ban_alert(torrent_handle h, tcp::endpoint const& ep peer_ban_alert(torrent_handle h, tcp::endpoint const& ep
, peer_id const& peer_id) , peer_id const& peer_id);
: peer_alert(h, ep, peer_id)
{}
TORRENT_DEFINE_ALERT(peer_ban_alert); TORRENT_DEFINE_ALERT(peer_ban_alert);
virtual std::string message() const; virtual std::string message() const;
}; };
// This alert is generated when a peer is unsnubbed. Essentially whe n it was snubbed for stalling // This alert is generated when a peer is unsnubbed. Essentially whe n it was snubbed for stalling
// sending data, and now it started sending data again. // sending data, and now it started sending data again.
struct TORRENT_EXPORT peer_unsnubbed_alert: peer_alert struct TORRENT_EXPORT peer_unsnubbed_alert: peer_alert
{ {
// internal // internal
peer_unsnubbed_alert(torrent_handle h, tcp::endpoint const& ep peer_unsnubbed_alert(torrent_handle h, tcp::endpoint const& ep
, peer_id const& peer_id) , peer_id const& peer_id);
: peer_alert(h, ep, peer_id)
{}
TORRENT_DEFINE_ALERT(peer_unsnubbed_alert); TORRENT_DEFINE_ALERT(peer_unsnubbed_alert);
virtual std::string message() const; virtual std::string message() const;
}; };
// This alert is generated when a peer is snubbed, when it stops sen ding data when we request // This alert is generated when a peer is snubbed, when it stops sen ding data when we request
// it. // it.
struct TORRENT_EXPORT peer_snubbed_alert: peer_alert struct TORRENT_EXPORT peer_snubbed_alert: peer_alert
{ {
// internal // internal
peer_snubbed_alert(torrent_handle h, tcp::endpoint const& ep peer_snubbed_alert(torrent_handle h, tcp::endpoint const& ep
, peer_id const& peer_id) , peer_id const& peer_id);
: peer_alert(h, ep, peer_id)
{}
TORRENT_DEFINE_ALERT(peer_snubbed_alert); TORRENT_DEFINE_ALERT(peer_snubbed_alert);
virtual std::string message() const; virtual std::string message() const;
}; };
// This alert is generated when a peer sends invalid data over the p eer-peer protocol. The peer // This alert is generated when a peer sends invalid data over the p eer-peer protocol. The peer
// will be disconnected, but you get its ip address from the alert, to identify it. // will be disconnected, but you get its ip address from the alert, to identify it.
struct TORRENT_EXPORT peer_error_alert: peer_alert struct TORRENT_EXPORT peer_error_alert: peer_alert
{ {
// internal // internal
peer_error_alert(torrent_handle const& h, tcp::endpoint cons t& ep peer_error_alert(torrent_handle const& h, tcp::endpoint cons t& ep
, peer_id const& peer_id, error_code const& e) , peer_id const& peer_id, error_code const& e);
: peer_alert(h, ep, peer_id)
, error(e)
{
#ifndef TORRENT_NO_DEPRECATE
msg = convert_from_native(error.message());
#endif
}
TORRENT_DEFINE_ALERT(peer_error_alert); TORRENT_DEFINE_ALERT(peer_error_alert);
const static int static_category = alert::peer_notification; const static int static_category = alert::peer_notification;
virtual std::string message() const virtual std::string message() const;
{
return peer_alert::message() + " peer error: " + con
vert_from_native(error.message());
}
// tells you what error caused this alert. // tells you what error caused this alert.
error_code error; error_code error;
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
std::string msg; std::string msg;
#endif #endif
}; };
// This alert is posted every time an outgoing peer connect attempts succeeds. // This alert is posted every time an outgoing peer connect attempts succeeds.
struct TORRENT_EXPORT peer_connect_alert: peer_alert struct TORRENT_EXPORT peer_connect_alert: peer_alert
{ {
// internal // internal
peer_connect_alert(torrent_handle h, tcp::endpoint const& ep peer_connect_alert(torrent_handle h, tcp::endpoint const& ep
, peer_id const& peer_id, int type) , peer_id const& peer_id, int type);
: peer_alert(h, ep, peer_id)
, socket_type(type)
{}
TORRENT_DEFINE_ALERT(peer_connect_alert); TORRENT_DEFINE_ALERT(peer_connect_alert);
const static int static_category = alert::debug_notification ; const static int static_category = alert::debug_notification ;
virtual std::string message() const; virtual std::string message() const;
int socket_type; int socket_type;
}; };
// This alert is generated when a peer is disconnected for any reaso n (other than the ones // This alert is generated when a peer is disconnected for any reaso n (other than the ones
// covered by peer_error_alert ). // covered by peer_error_alert ).
struct TORRENT_EXPORT peer_disconnected_alert: peer_alert struct TORRENT_EXPORT peer_disconnected_alert: peer_alert
{ {
// internal // internal
peer_disconnected_alert(torrent_handle const& h, tcp::endpoi nt const& ep peer_disconnected_alert(torrent_handle const& h, tcp::endpoi nt const& ep
, peer_id const& peer_id, error_code const& e) , peer_id const& peer_id, error_code const& e);
: peer_alert(h, ep, peer_id)
, error(e)
{
#ifndef TORRENT_NO_DEPRECATE
msg = convert_from_native(error.message());
#endif
}
TORRENT_DEFINE_ALERT(peer_disconnected_alert); TORRENT_DEFINE_ALERT(peer_disconnected_alert);
const static int static_category = alert::debug_notification ; const static int static_category = alert::debug_notification ;
virtual std::string message() const; virtual std::string message() const;
// tells you what error caused peer to disconnect. // tells you what error caused peer to disconnect.
error_code error; error_code error;
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
skipping to change at line 732 skipping to change at line 631
#endif #endif
}; };
// This is a debug alert that is generated by an incoming invalid pi ece request. // This is a debug alert that is generated by an incoming invalid pi ece request.
// ``ip`` is the address of the peer and the ``request`` is the actu al incoming // ``ip`` is the address of the peer and the ``request`` is the actu al incoming
// request from the peer. See peer_request for more info. // request from the peer. See peer_request for more info.
struct TORRENT_EXPORT invalid_request_alert: peer_alert struct TORRENT_EXPORT invalid_request_alert: peer_alert
{ {
// internal // internal
invalid_request_alert(torrent_handle const& h, tcp::endpoint const& ep invalid_request_alert(torrent_handle const& h, tcp::endpoint const& ep
, peer_id const& peer_id, peer_request const& r) , peer_id const& peer_id, peer_request const& r);
: peer_alert(h, ep, peer_id)
, request(r)
{}
TORRENT_DEFINE_ALERT(invalid_request_alert); TORRENT_DEFINE_ALERT(invalid_request_alert);
virtual std::string message() const; virtual std::string message() const;
peer_request request; peer_request request;
}; };
// This alert is generated when a torrent switches from being a down loader to a seed. // This alert is generated when a torrent switches from being a down loader to a seed.
// It will only be generated once per torrent. It contains a torrent _handle to the // It will only be generated once per torrent. It contains a torrent _handle to the
// torrent in question. // torrent in question.
struct TORRENT_EXPORT torrent_finished_alert: torrent_alert struct TORRENT_EXPORT torrent_finished_alert: torrent_alert
{ {
// internal // internal
torrent_finished_alert( torrent_finished_alert(const torrent_handle& h);
const torrent_handle& h)
: torrent_alert(h)
{}
TORRENT_DEFINE_ALERT(torrent_finished_alert); TORRENT_DEFINE_ALERT(torrent_finished_alert);
const static int static_category = alert::status_notificatio n; const static int static_category = alert::status_notificatio n;
virtual std::string message() const virtual std::string message() const;
{ return torrent_alert::message() + " torrent finished downl
oading"; }
}; };
// this alert is posted every time a piece completes downloading // this alert is posted every time a piece completes downloading
// and passes the hash check. This alert derives from torrent_alert // and passes the hash check. This alert derives from torrent_alert
// which contains the torrent_handle to the torrent the piece belong s to. // which contains the torrent_handle to the torrent the piece belong s to.
struct TORRENT_EXPORT piece_finished_alert: torrent_alert struct TORRENT_EXPORT piece_finished_alert: torrent_alert
{ {
// internal // internal
piece_finished_alert( piece_finished_alert(
const torrent_handle& h const torrent_handle& h
, int piece_num) , int piece_num);
: torrent_alert(h)
, piece_index(piece_num)
{ TORRENT_ASSERT(piece_index >= 0);}
TORRENT_DEFINE_ALERT(piece_finished_alert); TORRENT_DEFINE_ALERT(piece_finished_alert);
const static int static_category = alert::progress_notificat ion; const static int static_category = alert::progress_notificat ion;
virtual std::string message() const; virtual std::string message() const;
// the index of the piece that finished // the index of the piece that finished
int piece_index; int piece_index;
}; };
// This alert is generated when a peer rejects or ignores a piece re quest. // This alert is generated when a peer rejects or ignores a piece re quest.
struct TORRENT_EXPORT request_dropped_alert: peer_alert struct TORRENT_EXPORT request_dropped_alert: peer_alert
{ {
// internal // internal
request_dropped_alert(const torrent_handle& h, tcp::endpoint const& ep request_dropped_alert(const torrent_handle& h, tcp::endpoint const& ep
, peer_id const& peer_id, int block_num, int piece_n , peer_id const& peer_id, int block_num, int piece_n
um) um);
: peer_alert(h, ep, peer_id)
, block_index(block_num)
, piece_index(piece_num)
{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}
TORRENT_DEFINE_ALERT(request_dropped_alert); TORRENT_DEFINE_ALERT(request_dropped_alert);
const static int static_category = alert::progress_notificat ion const static int static_category = alert::progress_notificat ion
| alert::peer_notification; | alert::peer_notification;
virtual std::string message() const; virtual std::string message() const;
int block_index; int block_index;
int piece_index; int piece_index;
}; };
// This alert is generated when a block request times out. // This alert is generated when a block request times out.
struct TORRENT_EXPORT block_timeout_alert: peer_alert struct TORRENT_EXPORT block_timeout_alert: peer_alert
{ {
// internal // internal
block_timeout_alert(const torrent_handle& h, tcp::endpoint c onst& ep block_timeout_alert(const torrent_handle& h, tcp::endpoint c onst& ep
, peer_id const& peer_id, int block_num, int piece_n , peer_id const& peer_id, int block_num, int piece_n
um) um);
: peer_alert(h, ep, peer_id)
, block_index(block_num)
, piece_index(piece_num)
{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}
TORRENT_DEFINE_ALERT(block_timeout_alert); TORRENT_DEFINE_ALERT(block_timeout_alert);
const static int static_category = alert::progress_notificat ion const static int static_category = alert::progress_notificat ion
| alert::peer_notification; | alert::peer_notification;
virtual std::string message() const; virtual std::string message() const;
int block_index; int block_index;
int piece_index; int piece_index;
}; };
// This alert is generated when a block request receives a response. // This alert is generated when a block request receives a response.
struct TORRENT_EXPORT block_finished_alert: peer_alert struct TORRENT_EXPORT block_finished_alert: peer_alert
{ {
// internal // internal
block_finished_alert(const torrent_handle& h, tcp::endpoint const& ep block_finished_alert(const torrent_handle& h, tcp::endpoint const& ep
, peer_id const& peer_id, int block_num, int piece_n , peer_id const& peer_id, int block_num, int piece_n
um) um);
: peer_alert(h, ep, peer_id)
, block_index(block_num)
, piece_index(piece_num)
{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}
TORRENT_DEFINE_ALERT(block_finished_alert); TORRENT_DEFINE_ALERT(block_finished_alert);
const static int static_category = alert::progress_notificat ion; const static int static_category = alert::progress_notificat ion;
virtual std::string message() const; virtual std::string message() const;
int block_index; int block_index;
int piece_index; int piece_index;
}; };
// This alert is generated when a block request is sent to a peer. // This alert is generated when a block request is sent to a peer.
struct TORRENT_EXPORT block_downloading_alert: peer_alert struct TORRENT_EXPORT block_downloading_alert: peer_alert
{ {
// internal // internal
block_downloading_alert(const torrent_handle& h, tcp::endpoi nt const& ep block_downloading_alert(const torrent_handle& h, tcp::endpoi nt const& ep
, peer_id const& peer_id, char const* speedmsg, int , peer_id const& peer_id, char const* speedmsg, int
block_num, int piece_num) block_num, int piece_num);
: peer_alert(h, ep, peer_id)
, peer_speedmsg(speedmsg)
, block_index(block_num)
, piece_index(piece_num)
{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0); }
TORRENT_DEFINE_ALERT(block_downloading_alert); TORRENT_DEFINE_ALERT(block_downloading_alert);
const static int static_category = alert::progress_notificat ion; const static int static_category = alert::progress_notificat ion;
virtual std::string message() const; virtual std::string message() const;
char const* peer_speedmsg; char const* peer_speedmsg;
int block_index; int block_index;
int piece_index; int piece_index;
}; };
// This alert is generated when a block is received that was not req uested or // This alert is generated when a block is received that was not req uested or
// whose request timed out. // whose request timed out.
struct TORRENT_EXPORT unwanted_block_alert: peer_alert struct TORRENT_EXPORT unwanted_block_alert: peer_alert
{ {
// internal // internal
unwanted_block_alert(const torrent_handle& h, tcp::endpoint const& ep unwanted_block_alert(const torrent_handle& h, tcp::endpoint const& ep
, peer_id const& peer_id, int block_num, int piece_n , peer_id const& peer_id, int block_num, int piece_n
um) um);
: peer_alert(h, ep, peer_id)
, block_index(block_num)
, piece_index(piece_num)
{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}
TORRENT_DEFINE_ALERT(unwanted_block_alert); TORRENT_DEFINE_ALERT(unwanted_block_alert);
virtual std::string message() const; virtual std::string message() const;
int block_index; int block_index;
int piece_index; int piece_index;
}; };
// The ``storage_moved_alert`` is generated when all the disk IO has completed and the // The ``storage_moved_alert`` is generated when all the disk IO has completed and the
// files have been moved, as an effect of a call to ``torrent_handle ::move_storage``. This // files have been moved, as an effect of a call to ``torrent_handle ::move_storage``. This
// is useful to synchronize with the actual disk. The ``path`` membe r is the new path of // is useful to synchronize with the actual disk. The ``path`` membe r is the new path of
// the storage. // the storage.
struct TORRENT_EXPORT storage_moved_alert: torrent_alert struct TORRENT_EXPORT storage_moved_alert: torrent_alert
{ {
// internal // internal
storage_moved_alert(torrent_handle const& h, std::string con storage_moved_alert(torrent_handle const& h, std::string con
st& p) st& p);
: torrent_alert(h)
, path(p)
{}
TORRENT_DEFINE_ALERT(storage_moved_alert); TORRENT_DEFINE_ALERT(storage_moved_alert);
const static int static_category = alert::storage_notificati on; const static int static_category = alert::storage_notificati on;
virtual std::string message() const virtual std::string message() const;
{
return torrent_alert::message() + " moved storage to
: "
+ path;
}
std::string path; std::string path;
}; };
// The ``storage_moved_failed_alert`` is generated when an attempt t o move the storage, // The ``storage_moved_failed_alert`` is generated when an attempt t o move the storage,
// via torrent_handle::move_storage(), fails. // via torrent_handle::move_storage(), fails.
struct TORRENT_EXPORT storage_moved_failed_alert: torrent_alert struct TORRENT_EXPORT storage_moved_failed_alert: torrent_alert
{ {
// internal // internal
storage_moved_failed_alert(torrent_handle const& h, error_co storage_moved_failed_alert(torrent_handle const& h, error_co
de const& e) de const& e);
: torrent_alert(h)
, error(e)
{}
TORRENT_DEFINE_ALERT(storage_moved_failed_alert); TORRENT_DEFINE_ALERT(storage_moved_failed_alert);
const static int static_category = alert::storage_notificati on; const static int static_category = alert::storage_notificati on;
virtual std::string message() const virtual std::string message() const;
{
return torrent_alert::message() + " storage move fai
led: "
+ convert_from_native(error.message());
}
error_code error; error_code error;
}; };
// This alert is generated when a request to delete the files of a t orrent complete. // This alert is generated when a request to delete the files of a t orrent complete.
// //
// The ``info_hash`` is the info-hash of the torrent that was just d eleted. Most of // The ``info_hash`` is the info-hash of the torrent that was just d eleted. Most of
// the time the torrent_handle in the ``torrent_alert`` will be inva lid by the time // the time the torrent_handle in the ``torrent_alert`` will be inva lid by the time
// this alert arrives, since the torrent is being deleted. The ``inf o_hash`` member // this alert arrives, since the torrent is being deleted. The ``inf o_hash`` member
// is hence the main way of identifying which torrent just completed the delete. // is hence the main way of identifying which torrent just completed the delete.
// //
// This alert is posted in the ``storage_notification`` category, an d that bit // This alert is posted in the ``storage_notification`` category, an d that bit
// needs to be set in the alert_mask. // needs to be set in the alert_mask.
struct TORRENT_EXPORT torrent_deleted_alert: torrent_alert struct TORRENT_EXPORT torrent_deleted_alert: torrent_alert
{ {
// internal // internal
torrent_deleted_alert(torrent_handle const& h, sha1_hash con torrent_deleted_alert(torrent_handle const& h, sha1_hash con
st& ih) st& ih);
: torrent_alert(h)
{ info_hash = ih; }
TORRENT_DEFINE_ALERT(torrent_deleted_alert); TORRENT_DEFINE_ALERT(torrent_deleted_alert);
const static int static_category = alert::storage_notificati on; const static int static_category = alert::storage_notificati on;
virtual std::string message() const virtual std::string message() const;
{ return torrent_alert::message() + " deleted"; }
virtual bool discardable() const { return false; } virtual bool discardable() const { return false; }
sha1_hash info_hash; sha1_hash info_hash;
}; };
// This alert is generated when a request to delete the files of a t orrent fails. // This alert is generated when a request to delete the files of a t orrent fails.
// Just removing a torrent from the session cannot fail // Just removing a torrent from the session cannot fail
struct TORRENT_EXPORT torrent_delete_failed_alert: torrent_alert struct TORRENT_EXPORT torrent_delete_failed_alert: torrent_alert
{ {
// internal // internal
torrent_delete_failed_alert(torrent_handle const& h, error_c torrent_delete_failed_alert(torrent_handle const& h, error_c
ode const& e, sha1_hash const& ih) ode const& e
: torrent_alert(h) , sha1_hash const& ih);
, error(e)
, info_hash(ih)
{
#ifndef TORRENT_NO_DEPRECATE
msg = convert_from_native(error.message());
#endif
}
TORRENT_DEFINE_ALERT(torrent_delete_failed_alert); TORRENT_DEFINE_ALERT(torrent_delete_failed_alert);
const static int static_category = alert::storage_notificati on const static int static_category = alert::storage_notificati on
| alert::error_notification; | alert::error_notification;
virtual std::string message() const virtual std::string message() const;
{
return torrent_alert::message() + " torrent deletion
failed: "
+convert_from_native(error.message());
}
virtual bool discardable() const { return false; } virtual bool discardable() const { return false; }
// tells you why it failed. // tells you why it failed.
error_code error; error_code error;
// the info hash of the torrent whose files failed to be del eted // the info hash of the torrent whose files failed to be del eted
sha1_hash info_hash; sha1_hash info_hash;
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
std::string msg; std::string msg;
#endif #endif
}; };
// This alert is generated as a response to a ``torrent_handle::save _resume_data`` request. // This alert is generated as a response to a ``torrent_handle::save _resume_data`` request.
// It is generated once the disk IO thread is done writing the state for this torrent. // It is generated once the disk IO thread is done writing the state for this torrent.
struct TORRENT_EXPORT save_resume_data_alert: torrent_alert struct TORRENT_EXPORT save_resume_data_alert: torrent_alert
{ {
// internal // internal
save_resume_data_alert(boost::shared_ptr<entry> const& rd save_resume_data_alert(boost::shared_ptr<entry> const& rd
, torrent_handle const& h) , torrent_handle const& h);
: torrent_alert(h)
, resume_data(rd)
{}
TORRENT_DEFINE_ALERT(save_resume_data_alert); TORRENT_DEFINE_ALERT(save_resume_data_alert);
const static int static_category = alert::storage_notificati on; const static int static_category = alert::storage_notificati on;
virtual std::string message() const virtual std::string message() const;
{ return torrent_alert::message() + " resume data generated"
; }
virtual bool discardable() const { return false; } virtual bool discardable() const { return false; }
// points to the resume data. // points to the resume data.
boost::shared_ptr<entry> resume_data; boost::shared_ptr<entry> resume_data;
}; };
// This alert is generated instead of ``save_resume_data_alert`` if there was an error // This alert is generated instead of ``save_resume_data_alert`` if there was an error
// generating the resume data. ``error`` describes what went wrong. // generating the resume data. ``error`` describes what went wrong.
struct TORRENT_EXPORT save_resume_data_failed_alert: torrent_alert struct TORRENT_EXPORT save_resume_data_failed_alert: torrent_alert
{ {
// internal // internal
save_resume_data_failed_alert(torrent_handle const& h save_resume_data_failed_alert(torrent_handle const& h
, error_code const& e) , error_code const& e);
: torrent_alert(h)
, error(e)
{
#ifndef TORRENT_NO_DEPRECATE
msg = convert_from_native(error.message());
#endif
}
TORRENT_DEFINE_ALERT(save_resume_data_failed_alert); TORRENT_DEFINE_ALERT(save_resume_data_failed_alert);
const static int static_category = alert::storage_notificati on const static int static_category = alert::storage_notificati on
| alert::error_notification; | alert::error_notification;
virtual std::string message() const virtual std::string message() const;
{
return torrent_alert::message() + " resume data was
not generated: "
+ convert_from_native(error.message());
}
virtual bool discardable() const { return false; } virtual bool discardable() const { return false; }
error_code error; error_code error;
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
std::string msg; std::string msg;
#endif #endif
}; };
// This alert is generated as a response to a ``torrent_handle::paus e`` request. It is // This alert is generated as a response to a ``torrent_handle::paus e`` request. It is
// generated once all disk IO is complete and the files in the torre nt have been closed. // generated once all disk IO is complete and the files in the torre nt have been closed.
// This is useful for synchronizing with the disk. // This is useful for synchronizing with the disk.
struct TORRENT_EXPORT torrent_paused_alert: torrent_alert struct TORRENT_EXPORT torrent_paused_alert: torrent_alert
{ {
// internal // internal
torrent_paused_alert(torrent_handle const& h) torrent_paused_alert(torrent_handle const& h);
: torrent_alert(h)
{}
TORRENT_DEFINE_ALERT(torrent_paused_alert); TORRENT_DEFINE_ALERT(torrent_paused_alert);
const static int static_category = alert::status_notificatio n; const static int static_category = alert::status_notificatio n;
virtual std::string message() const virtual std::string message() const;
{ return torrent_alert::message() + " paused"; }
}; };
// This alert is generated as a response to a torrent_handle::resume () request. It is // This alert is generated as a response to a torrent_handle::resume () request. It is
// generated when a torrent goes from a paused state to an active st ate. // generated when a torrent goes from a paused state to an active st ate.
struct TORRENT_EXPORT torrent_resumed_alert: torrent_alert struct TORRENT_EXPORT torrent_resumed_alert: torrent_alert
{ {
// internal // internal
torrent_resumed_alert(torrent_handle const& h) torrent_resumed_alert(torrent_handle const& h);
: torrent_alert(h) {}
TORRENT_DEFINE_ALERT(torrent_resumed_alert); TORRENT_DEFINE_ALERT(torrent_resumed_alert);
const static int static_category = alert::status_notificatio n; const static int static_category = alert::status_notificatio n;
virtual std::string message() const virtual std::string message() const;
{ return torrent_alert::message() + " resumed"; }
}; };
// This alert is posted when a torrent completes checking. i.e. when it transitions // This alert is posted when a torrent completes checking. i.e. when it transitions
// out of the ``checking files`` state into a state where it is read y to start downloading // out of the ``checking files`` state into a state where it is read y to start downloading
struct TORRENT_EXPORT torrent_checked_alert: torrent_alert struct TORRENT_EXPORT torrent_checked_alert: torrent_alert
{ {
// internal // internal
torrent_checked_alert(torrent_handle const& h) torrent_checked_alert(torrent_handle const& h);
: torrent_alert(h)
{}
TORRENT_DEFINE_ALERT(torrent_checked_alert); TORRENT_DEFINE_ALERT(torrent_checked_alert);
const static int static_category = alert::status_notificatio n; const static int static_category = alert::status_notificatio n;
virtual std::string message() const virtual std::string message() const;
{ return torrent_alert::message() + " checked"; }
}; };
// This alert is generated when a HTTP seed name lookup fails. // This alert is generated when a HTTP seed name lookup fails.
struct TORRENT_EXPORT url_seed_alert: torrent_alert struct TORRENT_EXPORT url_seed_alert: torrent_alert
{ {
// internal // internal
url_seed_alert( url_seed_alert(
torrent_handle const& h torrent_handle const& h
, std::string const& u , std::string const& u
, error_code const& e) , error_code const& e);
: torrent_alert(h)
, url(u)
, msg(convert_from_native(e.message()))
{}
url_seed_alert( url_seed_alert(
torrent_handle const& h torrent_handle const& h
, std::string const& u , std::string const& u
, std::string const& m) , std::string const& m);
: torrent_alert(h)
, url(u)
, msg(m)
{}
TORRENT_DEFINE_ALERT(url_seed_alert); TORRENT_DEFINE_ALERT(url_seed_alert);
const static int static_category = alert::peer_notification | alert::error_notification; const static int static_category = alert::peer_notification | alert::error_notification;
virtual std::string message() const virtual std::string message() const;
{
return torrent_alert::message() + " url seed ("
+ url + ") failed: " + msg;
}
// the HTTP seed that failed // the HTTP seed that failed
std::string url; std::string url;
// the error message, potentially from the server // the error message, potentially from the server
std::string msg; std::string msg;
}; };
// If the storage fails to read or write files that it needs access to, this alert is // If the storage fails to read or write files that it needs access to, this alert is
// generated and the torrent is paused. // generated and the torrent is paused.
struct TORRENT_EXPORT file_error_alert: torrent_alert struct TORRENT_EXPORT file_error_alert: torrent_alert
{ {
// internal // internal
file_error_alert( file_error_alert(
std::string const& f std::string const& f
, torrent_handle const& h , torrent_handle const& h
, error_code const& e) , error_code const& e);
: torrent_alert(h)
, file(f)
, error(e)
{
#ifndef TORRENT_NO_DEPRECATE
msg = convert_from_native(error.message());
#endif
}
TORRENT_DEFINE_ALERT(file_error_alert); TORRENT_DEFINE_ALERT(file_error_alert);
const static int static_category = alert::status_notificatio n const static int static_category = alert::status_notificatio n
| alert::error_notification | alert::error_notification
| alert::storage_notification; | alert::storage_notification;
virtual std::string message() const virtual std::string message() const;
{
return torrent_alert::message() + " file (" + file +
") error: "
+ convert_from_native(error.message());
}
// the path to the file that was accessed when the error occ urred. // the path to the file that was accessed when the error occ urred.
std::string file; std::string file;
// the error code describing the error. // the error code describing the error.
error_code error; error_code error;
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
std::string msg; std::string msg;
#endif #endif
}; };
// This alert is generated when the metadata has been completely rec eived and the info-hash // This alert is generated when the metadata has been completely rec eived and the info-hash
// failed to match it. i.e. the metadata that was received was corru pt. libtorrent will // failed to match it. i.e. the metadata that was received was corru pt. libtorrent will
// automatically retry to fetch it in this case. This is only releva nt when running a // automatically retry to fetch it in this case. This is only releva nt when running a
// torrent-less download, with the metadata extension provided by li btorrent. // torrent-less download, with the metadata extension provided by li btorrent.
struct TORRENT_EXPORT metadata_failed_alert: torrent_alert struct TORRENT_EXPORT metadata_failed_alert: torrent_alert
{ {
// internal // internal
metadata_failed_alert(const torrent_handle& h, error_code e) metadata_failed_alert(const torrent_handle& h, error_code e)
: torrent_alert(h) ;
, error(e)
{}
TORRENT_DEFINE_ALERT(metadata_failed_alert); TORRENT_DEFINE_ALERT(metadata_failed_alert);
const static int static_category = alert::error_notification ; const static int static_category = alert::error_notification ;
virtual std::string message() const virtual std::string message() const;
{ return torrent_alert::message() + " invalid metadata recei
ved"; }
// the error that occurred // the error that occurred
error_code error; error_code error;
}; };
// This alert is generated when the metadata has been completely rec eived and the torrent // This alert is generated when the metadata has been completely rec eived and the torrent
// can start downloading. It is not generated on torrents that are s tarted with metadata, but // can start downloading. It is not generated on torrents that are s tarted with metadata, but
// only those that needs to download it from peers (when utilizing t he libtorrent extension). // only those that needs to download it from peers (when utilizing t he libtorrent extension).
// //
// There are no additional data members in this alert. // There are no additional data members in this alert.
skipping to change at line 1227 skipping to change at line 1016
// if (f) { // if (f) {
// fwrite(&buffer[0], 1, buffer.size(), f); // fwrite(&buffer[0], 1, buffer.size(), f);
// fclose(f); // fclose(f);
// } // }
// } // }
// //
struct TORRENT_EXPORT metadata_received_alert: torrent_alert struct TORRENT_EXPORT metadata_received_alert: torrent_alert
{ {
// internal // internal
metadata_received_alert( metadata_received_alert(
const torrent_handle& h) const torrent_handle& h);
: torrent_alert(h)
{}
TORRENT_DEFINE_ALERT(metadata_received_alert); TORRENT_DEFINE_ALERT(metadata_received_alert);
const static int static_category = alert::status_notificatio n; const static int static_category = alert::status_notificatio n;
virtual std::string message() const virtual std::string message() const;
{ return torrent_alert::message() + " metadata successfully
received"; }
}; };
// This alert is posted when there is an error on the UDP socket. Th e // This alert is posted when there is an error on the UDP socket. Th e
// UDP socket is used for all uTP, DHT and UDP tracker traffic. It's // UDP socket is used for all uTP, DHT and UDP tracker traffic. It's
// global to the session. // global to the session.
struct TORRENT_EXPORT udp_error_alert: alert struct TORRENT_EXPORT udp_error_alert: alert
{ {
// internal // internal
udp_error_alert( udp_error_alert(
udp::endpoint const& ep udp::endpoint const& ep
, error_code const& ec) , error_code const& ec);
: endpoint(ep)
, error(ec)
{}
TORRENT_DEFINE_ALERT(udp_error_alert); TORRENT_DEFINE_ALERT(udp_error_alert);
const static int static_category = alert::error_notification ; const static int static_category = alert::error_notification ;
virtual std::string message() const virtual std::string message() const;
{
error_code ec;
return "UDP error: " + convert_from_native(error.mes
sage()) + " from: " + endpoint.address().to_string(ec);
}
// the source address associated with the error (if any) // the source address associated with the error (if any)
udp::endpoint endpoint; udp::endpoint endpoint;
// the error code describing the error // the error code describing the error
error_code error; error_code error;
}; };
// Whenever libtorrent learns about the machines external IP, this a lert is // Whenever libtorrent learns about the machines external IP, this a lert is
// generated. The external IP address can be acquired from the track er (if it // generated. The external IP address can be acquired from the track er (if it
// supports that) or from peers that supports the extension protocol . // supports that) or from peers that supports the extension protocol .
// The address can be accessed through the ``external_address`` memb er. // The address can be accessed through the ``external_address`` memb er.
struct TORRENT_EXPORT external_ip_alert: alert struct TORRENT_EXPORT external_ip_alert: alert
{ {
// internal // internal
external_ip_alert(address const& ip) external_ip_alert(address const& ip);
: external_address(ip)
{}
TORRENT_DEFINE_ALERT(external_ip_alert); TORRENT_DEFINE_ALERT(external_ip_alert);
const static int static_category = alert::status_notificatio n; const static int static_category = alert::status_notificatio n;
virtual std::string message() const virtual std::string message() const;
{
error_code ec;
return "external IP received: " + external_address.t
o_string(ec);
}
// the IP address that is believed to be our external IP // the IP address that is believed to be our external IP
address external_address; address external_address;
}; };
// This alert is generated when none of the ports, given in the port range, to // This alert is generated when none of the ports, given in the port range, to
// session can be opened for listening. The ``endpoint`` member is t he // session can be opened for listening. The ``endpoint`` member is t he
// interface and port that failed, ``error`` is the error code descr ibing // interface and port that failed, ``error`` is the error code descr ibing
// the failure. // the failure.
// //
skipping to change at line 1309 skipping to change at line 1082
// listen on it. // listen on it.
struct TORRENT_EXPORT listen_failed_alert: alert struct TORRENT_EXPORT listen_failed_alert: alert
{ {
enum socket_type_t { tcp, tcp_ssl, udp, i2p, socks5 }; enum socket_type_t { tcp, tcp_ssl, udp, i2p, socks5 };
// internal // internal
listen_failed_alert( listen_failed_alert(
tcp::endpoint const& ep tcp::endpoint const& ep
, int op , int op
, error_code const& ec , error_code const& ec
, socket_type_t t) , socket_type_t t);
: endpoint(ep)
, error(ec)
, operation(op)
, sock_type(t)
{}
TORRENT_DEFINE_ALERT(listen_failed_alert); TORRENT_DEFINE_ALERT(listen_failed_alert);
const static int static_category = alert::status_notificatio n | alert::error_notification; const static int static_category = alert::status_notificatio n | alert::error_notification;
virtual std::string message() const; virtual std::string message() const;
virtual bool discardable() const { return false; } virtual bool discardable() const { return false; }
// the endpoint libtorrent attempted to listen on // the endpoint libtorrent attempted to listen on
tcp::endpoint endpoint; tcp::endpoint endpoint;
skipping to change at line 1348 skipping to change at line 1116
}; };
// This alert is posted when the listen port succeeds to be opened o n a // This alert is posted when the listen port succeeds to be opened o n a
// particular interface. ``endpoint`` is the endpoint that successfu lly // particular interface. ``endpoint`` is the endpoint that successfu lly
// was opened for listening. // was opened for listening.
struct TORRENT_EXPORT listen_succeeded_alert: alert struct TORRENT_EXPORT listen_succeeded_alert: alert
{ {
enum socket_type_t { tcp, tcp_ssl, udp }; enum socket_type_t { tcp, tcp_ssl, udp };
// internal // internal
listen_succeeded_alert(tcp::endpoint const& ep, socket_type_ listen_succeeded_alert(tcp::endpoint const& ep, socket_type_
t t) t t);
: endpoint(ep)
, sock_type(t)
{}
TORRENT_DEFINE_ALERT(listen_succeeded_alert); TORRENT_DEFINE_ALERT(listen_succeeded_alert);
const static int static_category = alert::status_notificatio n; const static int static_category = alert::status_notificatio n;
virtual std::string message() const; virtual std::string message() const;
virtual bool discardable() const { return false; } virtual bool discardable() const { return false; }
// the endpoint libtorrent ended up listening on. The addres s // the endpoint libtorrent ended up listening on. The addres s
// refers to the local interface and the port is the listen port. // refers to the local interface and the port is the listen port.
tcp::endpoint endpoint; tcp::endpoint endpoint;
skipping to change at line 1376 skipping to change at line 1141
// This alert is generated when a NAT router was successfully found but some // This alert is generated when a NAT router was successfully found but some
// part of the port mapping request failed. It contains a text messa ge that // part of the port mapping request failed. It contains a text messa ge that
// may help the user figure out what is wrong. This alert is not gen erated in // may help the user figure out what is wrong. This alert is not gen erated in
// case it appears the client is not running on a NAT:ed network or if it // 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 a dd port // appears there is no NAT router that can be remote controlled to a dd port
// mappings. // mappings.
struct TORRENT_EXPORT portmap_error_alert: alert struct TORRENT_EXPORT portmap_error_alert: alert
{ {
// internal // internal
portmap_error_alert(int i, int t, error_code const& e) portmap_error_alert(int i, int t, error_code const& e);
: mapping(i), map_type(t), error(e)
{
#ifndef TORRENT_NO_DEPRECATE
msg = convert_from_native(error.message());
#endif
}
TORRENT_DEFINE_ALERT(portmap_error_alert); TORRENT_DEFINE_ALERT(portmap_error_alert);
const static int static_category = alert::port_mapping_notif ication const static int static_category = alert::port_mapping_notif ication
| alert::error_notification; | alert::error_notification;
virtual std::string message() const; virtual std::string message() const;
// refers to the mapping index of the port map that failed, i.e. // refers to the mapping index of the port map that failed, i.e.
// the index returned from add_mapping(). // the index returned from add_mapping().
int mapping; int mapping;
skipping to change at line 1411 skipping to change at line 1170
#endif #endif
}; };
// This alert is generated when a NAT router was successfully found and // 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 // 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 // capable router, this is typically generated once when mapping the TCP
// port and, if DHT is enabled, when the UDP port is mapped. // port and, if DHT is enabled, when the UDP port is mapped.
struct TORRENT_EXPORT portmap_alert: alert struct TORRENT_EXPORT portmap_alert: alert
{ {
// internal // internal
portmap_alert(int i, int port, int t) portmap_alert(int i, int port, int t);
: mapping(i), external_port(port), map_type(t)
{}
TORRENT_DEFINE_ALERT(portmap_alert); TORRENT_DEFINE_ALERT(portmap_alert);
const static int static_category = alert::port_mapping_notif ication; const static int static_category = alert::port_mapping_notif ication;
virtual std::string message() const; virtual std::string message() const;
// refers to the mapping index of the port map that failed, i.e. // refers to the mapping index of the port map that failed, i.e.
// the index returned from add_mapping(). // the index returned from add_mapping().
int mapping; int mapping;
skipping to change at line 1438 skipping to change at line 1195
int map_type; int map_type;
}; };
// This alert is generated to log informational events related to ei ther // This alert is generated to log informational events related to ei ther
// UPnP or NAT-PMP. They contain a log line and the type (0 = NAT-PM P // UPnP or NAT-PMP. They contain a log line and the type (0 = NAT-PM P
// and 1 = UPnP). Displaying these messages to an end user is only u seful // and 1 = UPnP). Displaying these messages to an end user is only u seful
// for debugging the UPnP or NAT-PMP implementation. // for debugging the UPnP or NAT-PMP implementation.
struct TORRENT_EXPORT portmap_log_alert: alert struct TORRENT_EXPORT portmap_log_alert: alert
{ {
// internal // internal
portmap_log_alert(int t, std::string const& m) portmap_log_alert(int t, std::string const& m);
: map_type(t), msg(m)
{}
TORRENT_DEFINE_ALERT(portmap_log_alert); TORRENT_DEFINE_ALERT(portmap_log_alert);
const static int static_category = alert::port_mapping_notif ication; const static int static_category = alert::port_mapping_notif ication;
virtual std::string message() const; virtual std::string message() const;
int map_type; int map_type;
std::string msg; std::string msg;
}; };
// This alert is generated when a fastresume file has been passed to add_torrent() but the // This alert is generated when a fastresume file has been passed to add_torrent() but the
// files on disk did not match the fastresume file. The error_code e xplains the reason why the // files on disk did not match the fastresume file. The error_code e xplains the reason why the
// resume file was rejected. // resume file was rejected.
struct TORRENT_EXPORT fastresume_rejected_alert: torrent_alert struct TORRENT_EXPORT fastresume_rejected_alert: torrent_alert
{ {
// internal // internal
fastresume_rejected_alert(torrent_handle const& h fastresume_rejected_alert(torrent_handle const& h
, error_code const& e) , error_code const& e);
: torrent_alert(h)
, error(e)
{
#ifndef TORRENT_NO_DEPRECATE
msg = convert_from_native(error.message());
#endif
}
TORRENT_DEFINE_ALERT(fastresume_rejected_alert); TORRENT_DEFINE_ALERT(fastresume_rejected_alert);
const static int static_category = alert::status_notificatio n const static int static_category = alert::status_notificatio n
| alert::error_notification; | alert::error_notification;
virtual std::string message() const virtual std::string message() const;
{ return torrent_alert::message() + " fast resume rejected:
" + convert_from_native(error.message()); }
error_code error; error_code error;
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
std::string msg; std::string msg;
#endif #endif
}; };
// This alert is posted when an incoming peer connection, or a peer that's about to be added // This alert 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 o f: // to our peer list, is blocked for some reason. This could be any o f:
// //
// * the IP filter // * the IP filter
// * i2p mixed mode restrictions (a normal peer is not allowed on an i2p swarm) // * i2p mixed mode restrictions (a normal peer is not allowed on an i2p swarm)
// * the port filter // * the port filter
// * the peer has a low port and ``no_connect_privileged_ports`` is enabled // * the peer has a low port and ``no_connect_privileged_ports`` is enabled
// * the protocol of the peer is blocked (uTP/TCP blocking) // * the protocol of the peer is blocked (uTP/TCP blocking)
struct TORRENT_EXPORT peer_blocked_alert: torrent_alert struct TORRENT_EXPORT peer_blocked_alert: torrent_alert
{ {
// internal // internal
peer_blocked_alert(torrent_handle const& h, address const& i peer_blocked_alert(torrent_handle const& h, address const& i
, int r) , int r);
: torrent_alert(h)
, ip(i)
, reason(r)
{}
TORRENT_DEFINE_ALERT(peer_blocked_alert); TORRENT_DEFINE_ALERT(peer_blocked_alert);
const static int static_category = alert::ip_block_notificat ion; const static int static_category = alert::ip_block_notificat ion;
virtual std::string message() const; virtual std::string message() const;
// the address that was blocked. // the address that was blocked.
address ip; address ip;
enum reason_t enum reason_t
skipping to change at line 1526 skipping to change at line 1269
int reason; int reason;
}; };
// This alert is generated when a DHT node announces to an info-hash on our // This alert is generated when a DHT node announces to an info-hash on our
// DHT node. It belongs to the ``dht_notification`` category. // DHT node. It belongs to the ``dht_notification`` category.
struct TORRENT_EXPORT dht_announce_alert: alert struct TORRENT_EXPORT dht_announce_alert: alert
{ {
// internal // internal
dht_announce_alert(address const& i, int p dht_announce_alert(address const& i, int p
, sha1_hash const& ih) , sha1_hash const& ih);
: ip(i)
, port(p)
, info_hash(ih)
{}
TORRENT_DEFINE_ALERT(dht_announce_alert); TORRENT_DEFINE_ALERT(dht_announce_alert);
const static int static_category = alert::dht_notification; const static int static_category = alert::dht_notification;
virtual std::string message() const; virtual std::string message() const;
address ip; address ip;
int port; int port;
sha1_hash info_hash; sha1_hash info_hash;
}; };
// This alert is generated when a DHT node sends a ``get_peers`` mes sage to // This alert is generated when a DHT node sends a ``get_peers`` mes sage to
// our DHT node. It belongs to the ``dht_notification`` category. // our DHT node. It belongs to the ``dht_notification`` category.
struct TORRENT_EXPORT dht_get_peers_alert: alert struct TORRENT_EXPORT dht_get_peers_alert: alert
{ {
// internal // internal
dht_get_peers_alert(sha1_hash const& ih) dht_get_peers_alert(sha1_hash const& ih);
: info_hash(ih)
{}
TORRENT_DEFINE_ALERT(dht_get_peers_alert); TORRENT_DEFINE_ALERT(dht_get_peers_alert);
const static int static_category = alert::dht_notification; const static int static_category = alert::dht_notification;
virtual std::string message() const; virtual std::string message() const;
sha1_hash info_hash; sha1_hash info_hash;
}; };
// This alert is posted approximately once every second, and it cont ains // This alert is posted approximately once every second, and it cont ains
skipping to change at line 1624 skipping to change at line 1361
}; };
// This alert is posted when a bittorrent feature is blocked because of the // This alert is posted when a bittorrent feature is blocked because of the
// anonymous mode. For instance, if the tracker proxy is not set up, no // 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 // trackers will be used, because trackers can only be used through proxies
// when in anonymous mode. // when in anonymous mode.
struct TORRENT_EXPORT anonymous_mode_alert: torrent_alert struct TORRENT_EXPORT anonymous_mode_alert: torrent_alert
{ {
// internal // internal
anonymous_mode_alert(torrent_handle const& h anonymous_mode_alert(torrent_handle const& h
, int k, std::string const& s) , int k, std::string const& s);
: torrent_alert(h)
, kind(k)
, str(s)
{}
TORRENT_DEFINE_ALERT(anonymous_mode_alert); TORRENT_DEFINE_ALERT(anonymous_mode_alert);
const static int static_category = alert::error_notification ; const static int static_category = alert::error_notification ;
virtual std::string message() const; virtual std::string message() const;
enum kind_t enum kind_t
{ {
// means that there's no proxy set up for tracker // means that there's no proxy set up for tracker
// communication and the tracker will not be contact ed. // communication and the tracker will not be contact ed.
skipping to change at line 1654 skipping to change at line 1387
int kind; int kind;
std::string str; std::string str;
}; };
// This alert is generated when we receive a local service discovery message // This alert is generated when we receive a local service discovery message
// from a peer for a torrent we're currently participating in. // from a peer for a torrent we're currently participating in.
struct TORRENT_EXPORT lsd_peer_alert: peer_alert struct TORRENT_EXPORT lsd_peer_alert: peer_alert
{ {
// internal // internal
lsd_peer_alert(torrent_handle const& h lsd_peer_alert(torrent_handle const& h
, tcp::endpoint const& i) , tcp::endpoint const& i);
: peer_alert(h, i, peer_id(0))
{}
TORRENT_DEFINE_ALERT(lsd_peer_alert); TORRENT_DEFINE_ALERT(lsd_peer_alert);
const static int static_category = alert::peer_notification; const static int static_category = alert::peer_notification;
virtual std::string message() const; virtual std::string message() const;
}; };
// This alert is posted whenever a tracker responds with a ``tracker id``. // This alert is posted whenever a tracker responds with a ``tracker id``.
// The tracker ID is like a cookie. The libtorrent will store the tr acker ID // The tracker ID is like a cookie. The libtorrent will store the tr acker ID
// for this tracker and repeat it in subsequent announces. // for this tracker and repeat it in subsequent announces.
struct TORRENT_EXPORT trackerid_alert: tracker_alert struct TORRENT_EXPORT trackerid_alert: tracker_alert
{ {
// internal // internal
trackerid_alert(torrent_handle const& h trackerid_alert(torrent_handle const& h
, std::string const& u , std::string const& u
, const std::string& id) , const std::string& id);
: tracker_alert(h, u)
, trackerid(id)
{}
TORRENT_DEFINE_ALERT(trackerid_alert); TORRENT_DEFINE_ALERT(trackerid_alert);
const static int static_category = alert::status_notificatio n; const static int static_category = alert::status_notificatio n;
virtual std::string message() const; virtual std::string message() const;
// The tracker ID returned by the tracker // The tracker ID returned by the tracker
std::string trackerid; std::string trackerid;
}; };
// This alert is posted when the initial DHT bootstrap is done. // This alert is posted when the initial DHT bootstrap is done.
struct TORRENT_EXPORT dht_bootstrap_alert: alert struct TORRENT_EXPORT dht_bootstrap_alert: alert
{ {
// internal // internal
dht_bootstrap_alert() {} dht_bootstrap_alert();
TORRENT_DEFINE_ALERT(dht_bootstrap_alert); TORRENT_DEFINE_ALERT(dht_bootstrap_alert);
const static int static_category = alert::dht_notification; const static int static_category = alert::dht_notification;
virtual std::string message() const; virtual std::string message() const;
}; };
// This alert is posted on RSS feed events such as start of RSS feed updates, // This alert is posted on RSS feed events such as start of RSS feed updates,
// successful completed updates and errors during updates. // successful completed updates and errors during updates.
// //
// This alert is only posted if the ``rss_notifications`` category i s enabled // This alert is only posted if the ``rss_notifications`` category i s enabled
// in the alert_mask. // in the alert_mask.
struct TORRENT_EXPORT rss_alert: alert struct TORRENT_EXPORT rss_alert: alert
{ {
// internal // internal
rss_alert(feed_handle h, std::string const& u, int s, error_ rss_alert(feed_handle h, std::string const& u, int s, error_
code const& ec) code const& ec);
: handle(h), url(u), state(s), error(ec)
{}
TORRENT_DEFINE_ALERT(rss_alert); TORRENT_DEFINE_ALERT(rss_alert);
const static int static_category = alert::rss_notification; const static int static_category = alert::rss_notification;
virtual std::string message() const; virtual std::string message() const;
enum state_t enum state_t
{ {
// An update of this feed was just initiated, it wil l either succeed // An update of this feed was just initiated, it wil l either succeed
// or fail soon. // or fail soon.
skipping to change at line 1750 skipping to change at line 1476
// an error code used for when an error occurs on the feed. // an error code used for when an error occurs on the feed.
error_code error; error_code error;
}; };
// This is posted whenever a torrent is transitioned into the error state. // This is posted whenever a torrent is transitioned into the error state.
struct TORRENT_EXPORT torrent_error_alert: torrent_alert struct TORRENT_EXPORT torrent_error_alert: torrent_alert
{ {
// internal // internal
torrent_error_alert(torrent_handle const& h torrent_error_alert(torrent_handle const& h
, error_code const& e) , error_code const& e);
: torrent_alert(h)
, error(e)
{}
TORRENT_DEFINE_ALERT(torrent_error_alert); TORRENT_DEFINE_ALERT(torrent_error_alert);
const static int static_category = alert::error_notification | alert::status_notification; const static int static_category = alert::error_notification | alert::status_notification;
virtual std::string message() const; virtual std::string message() const;
// specifies which error the torrent encountered. // specifies which error the torrent encountered.
error_code error; error_code error;
}; };
// This is always posted for SSL torrents. This is a reminder to the client that // This is always posted for SSL torrents. This is a reminder to the client that
// the torrent won't work unless torrent_handle::set_ssl_certificate () is called with // the torrent won't work unless torrent_handle::set_ssl_certificate () is called with
// a valid certificate. Valid certificates MUST be signed by the SSL certificate // a valid certificate. Valid certificates MUST be signed by the SSL certificate
// in the .torrent file. // in the .torrent file.
struct TORRENT_EXPORT torrent_need_cert_alert: torrent_alert struct TORRENT_EXPORT torrent_need_cert_alert: torrent_alert
{ {
// internal // internal
torrent_need_cert_alert(torrent_handle const& h) torrent_need_cert_alert(torrent_handle const& h);
: torrent_alert(h)
{}
TORRENT_DEFINE_ALERT(torrent_need_cert_alert); TORRENT_DEFINE_ALERT(torrent_need_cert_alert);
const static int static_category = alert::status_notificatio n; const static int static_category = alert::status_notificatio n;
virtual std::string message() const; virtual std::string message() const;
virtual bool discardable() const { return false; } virtual bool discardable() const { return false; }
error_code error; error_code error;
}; };
// The incoming connection alert is posted every time we successfull y accept // The incoming connection alert is posted every time we successfull y accept
// an incoming connection, through any mean. The most straigh-forwar d ways // an incoming connection, through any mean. The most straigh-forwar d ways
// of accepting incoming connections are through the TCP listen sock et and // of accepting incoming connections are through the TCP listen sock et and
// the UDP listen socket for uTP sockets. However, connections may a lso be // the UDP listen socket for uTP sockets. However, connections may a lso be
// accepted ofer a Socks5 or i2p listen socket, or via a torrent spe cific // accepted ofer a Socks5 or i2p listen socket, or via a torrent spe cific
// listen socket for SSL torrents. // listen socket for SSL torrents.
struct TORRENT_EXPORT incoming_connection_alert: alert struct TORRENT_EXPORT incoming_connection_alert: alert
{ {
// internal // internal
incoming_connection_alert(int t, tcp::endpoint const& i) incoming_connection_alert(int t, tcp::endpoint const& i);
: socket_type(t)
, ip(i)
{}
TORRENT_DEFINE_ALERT(incoming_connection_alert); TORRENT_DEFINE_ALERT(incoming_connection_alert);
const static int static_category = alert::peer_notification; const static int static_category = alert::peer_notification;
virtual std::string message() const; virtual std::string message() const;
// tells you what kind of socket the connection was accepted // tells you what kind of socket the connection was accepted
// as: // as:
// //
// 0. none (no socket instantiated) // 0. none (no socket instantiated)
skipping to change at line 1830 skipping to change at line 1548
tcp::endpoint ip; tcp::endpoint ip;
}; };
// This alert is always posted when a torrent was attempted to be ad ded // This alert is always posted when a torrent was attempted to be ad ded
// and contains the return status of the add operation. The torrent handle of the new // and contains the return status of the add operation. The torrent handle of the new
// torrent can be found in the base class' ``handle`` member. If add ing // torrent can be found in the base class' ``handle`` member. If add ing
// the torrent failed, ``error`` contains the error code. // the torrent failed, ``error`` contains the error code.
struct TORRENT_EXPORT add_torrent_alert : torrent_alert struct TORRENT_EXPORT add_torrent_alert : torrent_alert
{ {
// internal // internal
add_torrent_alert(torrent_handle h, add_torrent_params const add_torrent_alert(torrent_handle h, add_torrent_params const
& p, error_code ec) & p, error_code ec);
: torrent_alert(h)
, params(p)
, error(ec)
{}
TORRENT_DEFINE_ALERT(add_torrent_alert); TORRENT_DEFINE_ALERT(add_torrent_alert);
const static int static_category = alert::status_notificatio n; const static int static_category = alert::status_notificatio n;
virtual std::string message() const; virtual std::string message() const;
virtual bool discardable() const { return false; } virtual bool discardable() const { return false; }
// a copy of the parameters used when adding the torrent, it can be used // a copy of the parameters used when adding the torrent, it can be used
// to identify which invocation to ``async_add_torrent()`` c aused this alert. // to identify which invocation to ``async_add_torrent()`` c aused this alert.
add_torrent_params params; add_torrent_params params;
skipping to change at line 1878 skipping to change at line 1592
// When a torrent changes its info-hash, this alert is posted. This only happens in very // When a torrent changes its info-hash, this alert is posted. This only happens in very
// specific cases. For instance, when a torrent is downloaded from a URL, the true info // 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 do wnloaded and parsed. // hash is not known immediately. First the .torrent file must be do wnloaded and parsed.
// //
// Once this download completes, the ``torrent_update_alert`` is pos ted to notify the client // Once this download completes, the ``torrent_update_alert`` is pos ted to notify the client
// of the info-hash changing. // of the info-hash changing.
struct TORRENT_EXPORT torrent_update_alert : torrent_alert struct TORRENT_EXPORT torrent_update_alert : torrent_alert
{ {
// internal // internal
torrent_update_alert(torrent_handle h, sha1_hash const& old_ torrent_update_alert(torrent_handle h, sha1_hash const& old_
hash, sha1_hash const& new_hash) hash, sha1_hash const& new_hash);
: torrent_alert(h)
, old_ih(old_hash)
, new_ih(new_hash)
{}
TORRENT_DEFINE_ALERT(torrent_update_alert); TORRENT_DEFINE_ALERT(torrent_update_alert);
const static int static_category = alert::status_notificatio n; const static int static_category = alert::status_notificatio n;
virtual std::string message() const; virtual std::string message() const;
virtual bool discardable() const { return false; } virtual bool discardable() const { return false; }
// ``old_ih`` and ``new_ih`` are the previous and new info-h ash for the torrent, respectively. // ``old_ih`` and ``new_ih`` are the previous and new info-h ash for the torrent, respectively.
sha1_hash old_ih; sha1_hash old_ih;
sha1_hash new_ih; sha1_hash new_ih;
}; };
// This alert is posted every time a new RSS item (i.e. torrent) is received // This alert is posted every time a new RSS item (i.e. torrent) is received
// from an RSS feed. // from an RSS feed.
// //
// It is only posted if the ``rss_notifications`` category is enable d in the // It is only posted if the ``rss_notifications`` category is enable d in the
// alert_mask. // alert_mask.
struct TORRENT_EXPORT rss_item_alert : alert struct TORRENT_EXPORT rss_item_alert : alert
{ {
// internal // internal
rss_item_alert(feed_handle h, feed_item const& item) rss_item_alert(feed_handle h, feed_item const& item);
: handle(h)
, item(item)
{}
TORRENT_DEFINE_ALERT(rss_item_alert); TORRENT_DEFINE_ALERT(rss_item_alert);
const static int static_category = alert::rss_notification; const static int static_category = alert::rss_notification;
virtual std::string message() const; virtual std::string message() const;
feed_handle handle; feed_handle handle;
feed_item item; feed_item item;
}; };
// posted when something fails in the DHT. This is not necessarily a fatal // posted when something fails in the DHT. This is not necessarily a fatal
// error, but it could prevent proper operation // error, but it could prevent proper operation
struct TORRENT_EXPORT dht_error_alert: alert struct TORRENT_EXPORT dht_error_alert: alert
{ {
// internal // internal
dht_error_alert(int op, error_code const& ec) dht_error_alert(int op, error_code const& ec);
: error(ec), operation(op_t(op)) {}
TORRENT_DEFINE_ALERT(dht_error_alert); TORRENT_DEFINE_ALERT(dht_error_alert);
const static int static_category = alert::error_notification const static int static_category = alert::error_notification
| alert::dht_notification; | alert::dht_notification;
virtual std::string message() const; virtual std::string message() const;
// the error code // the error code
error_code error; error_code error;
skipping to change at line 1948 skipping to change at line 1654
}; };
// the operation that failed // the operation that failed
op_t operation; op_t operation;
}; };
// this alert is posted as a response to a call to session::get_item (), // this alert is posted as a response to a call to session::get_item (),
// specifically the overload for looking up immutable items in the D HT. // specifically the overload for looking up immutable items in the D HT.
struct TORRENT_EXPORT dht_immutable_item_alert: alert struct TORRENT_EXPORT dht_immutable_item_alert: alert
{ {
dht_immutable_item_alert(sha1_hash const& t, entry const& i) dht_immutable_item_alert(sha1_hash const& t, entry const& i)
: target(t), item(i) {} ;
TORRENT_DEFINE_ALERT(dht_immutable_item_alert); TORRENT_DEFINE_ALERT(dht_immutable_item_alert);
const static int static_category = alert::error_notification const static int static_category = alert::error_notification
| alert::dht_notification; | alert::dht_notification;
virtual std::string message() const; virtual std::string message() const;
virtual bool discardable() const { return false; } virtual bool discardable() const { return false; }
// the target hash of the immutable item. This must // the target hash of the immutable item. This must
// match the sha-1 hash of the bencoded form of ``item``. // match the sha-1 hash of the bencoded form of ``item``.
skipping to change at line 1974 skipping to change at line 1679
}; };
// this alert is posted as a response to a call to session::get_item (), // this alert is posted as a response to a call to session::get_item (),
// specifically the overload for looking up mutable items in the DHT . // specifically the overload for looking up mutable items in the DHT .
struct TORRENT_EXPORT dht_mutable_item_alert: alert struct TORRENT_EXPORT dht_mutable_item_alert: alert
{ {
dht_mutable_item_alert(boost::array<char, 32> k dht_mutable_item_alert(boost::array<char, 32> k
, boost::array<char, 64> sig , boost::array<char, 64> sig
, boost::uint64_t sequence , boost::uint64_t sequence
, std::string const& s , std::string const& s
, entry const& i) , entry const& i);
: key(k), signature(sig), seq(sequence), salt(s), it
em(i) {}
TORRENT_DEFINE_ALERT(dht_mutable_item_alert); TORRENT_DEFINE_ALERT(dht_mutable_item_alert);
const static int static_category = alert::error_notification const static int static_category = alert::error_notification
| alert::dht_notification; | alert::dht_notification;
virtual std::string message() const; virtual std::string message() const;
virtual bool discardable() const { return false; } virtual bool discardable() const { return false; }
// the public key that was looked up // the public key that was looked up
boost::array<char, 32> key; boost::array<char, 32> key;
skipping to change at line 2010 skipping to change at line 1714
// the data for this item // the data for this item
entry item; entry item;
}; };
// this is posted when a DHT put operation completes. This is useful if the // this is posted when a DHT put operation completes. This is useful if the
// client is waiting for a put to complete before shutting down for instance. // client is waiting for a put to complete before shutting down for instance.
struct TORRENT_EXPORT dht_put_alert: alert struct TORRENT_EXPORT dht_put_alert: alert
{ {
// internal // internal
dht_put_alert(sha1_hash const& t) dht_put_alert(sha1_hash const& t);
: target(t)
, seq(0)
{}
dht_put_alert(boost::array<char, 32> key dht_put_alert(boost::array<char, 32> key
, boost::array<char, 64> sig , boost::array<char, 64> sig
, std::string s , std::string s
, boost::uint64_t sequence_number) , boost::uint64_t sequence_number);
: target(0)
, public_key(key)
, signature(sig)
, salt(s)
, seq(sequence_number)
{}
TORRENT_DEFINE_ALERT(dht_put_alert); TORRENT_DEFINE_ALERT(dht_put_alert);
const static int static_category = alert::dht_notification; const static int static_category = alert::dht_notification;
virtual std::string message() const; virtual std::string message() const;
// the target hash the item was stored under if this was an *immutable* // the target hash the item was stored under if this was an *immutable*
// item. // item.
sha1_hash target; sha1_hash target;
skipping to change at line 2045 skipping to change at line 1740
// salt and sequence number the item was stored under. // salt and sequence number the item was stored under.
boost::array<char, 32> public_key; boost::array<char, 32> public_key;
boost::array<char, 64> signature; boost::array<char, 64> signature;
std::string salt; std::string salt;
boost::uint64_t seq; boost::uint64_t seq;
}; };
// this alert is used to report errors in the i2p SAM connection // this alert is used to report errors in the i2p SAM connection
struct TORRENT_EXPORT i2p_alert : alert struct TORRENT_EXPORT i2p_alert : alert
{ {
i2p_alert(error_code const& ec) : error(ec) {} i2p_alert(error_code const& ec);
TORRENT_DEFINE_ALERT(i2p_alert); TORRENT_DEFINE_ALERT(i2p_alert);
const static int static_category = alert::error_notification ; const static int static_category = alert::error_notification ;
virtual std::string message() const; virtual std::string message() const;
// the error that occurred in the i2p SAM connection // the error that occurred in the i2p SAM connection
error_code error; error_code error;
}; };
 End of changes. 94 change blocks. 
429 lines changed or deleted 112 lines changed or added


 bitfield.hpp   bitfield.hpp 
skipping to change at line 165 skipping to change at line 165
if (words[i] != 0xffffffff) return f alse; if (words[i] != 0xffffffff) return f alse;
} }
} }
// tail // tail
for (int i = num_words * 4; i < num_bytes; ++i) for (int i = num_words * 4; i < num_bytes; ++i)
{ {
if (bytes[i] != 0xff) return false; if (bytes[i] != 0xff) return false;
} }
int rest = m_size & 0x7; int rest = m_size & 0x7;
boost::uint8_t mask = (0xff << (8-rest)) & 0xff; if (rest > 0)
if (rest > 0 && (bytes[num_bytes] & mask) != mask) {
return false; boost::uint8_t mask = (0xff << (8-rest)) & 0
xff;
if ((bytes[num_bytes] & mask) != mask) retur
n false;
}
return true; return true;
} }
// returns the size of the bitfield in bits. // returns the size of the bitfield in bits.
int size() const { return m_size; } int size() const { return m_size; }
// returns true if the bitfield has zero size. // returns true if the bitfield has zero size.
bool empty() const { return m_size == 0; } bool empty() const { return m_size == 0; }
// returns a pointer to the internal buffer of the bitfield. // returns a pointer to the internal buffer of the bitfield.
 End of changes. 1 change blocks. 
3 lines changed or deleted 7 lines changed or added


 config.hpp   config.hpp 
skipping to change at line 58 skipping to change at line 58
#include <stdio.h> // for snprintf #include <stdio.h> // for snprintf
#include <limits.h> // for IOV_MAX #include <limits.h> // for IOV_MAX
#include "libtorrent/export.hpp" #include "libtorrent/export.hpp"
#if defined TORRENT_DEBUG_BUFFERS && !defined TORRENT_DISABLE_POOL_ALLOCATO R #if defined TORRENT_DEBUG_BUFFERS && !defined TORRENT_DISABLE_POOL_ALLOCATO R
#error TORRENT_DEBUG_BUFFERS only works if you also disable pool allocators with TORRENT_DISABLE_POOL_ALLOCATOR #error TORRENT_DEBUG_BUFFERS only works if you also disable pool allocators with TORRENT_DISABLE_POOL_ALLOCATOR
#endif #endif
#if !defined BOOST_ASIO_SEPARATE_COMPILATION && !defined BOOST_ASIO_DYN_LIN K #if !defined BOOST_ASIO_SEPARATE_COMPILATION && !defined BOOST_ASIO_DYN_LIN K
#error you must define either BOOST_ASIO_SEPARATE_COMPILATION or BOOST_ASIO #define BOOST_ASIO_SEPARATE_COMPILATION
_DYN_LINK in your project in \
order for asios declarations to be correct. If you are linking dynam
ically against libtorrent, define \
BOOST_ASIO_DYN_LINK otherwise BOOST_ASIO_SEPARATE_COMPILATION. You c
an also use pkg-config or boost \
build, to automatically apply these defines
#endif #endif
#ifndef _MSC_VER #ifndef _MSC_VER
#ifndef __STDC_FORMAT_MACROS #ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS 1 #define __STDC_FORMAT_MACROS 1
#endif #endif
#include <inttypes.h> // for PRId64 et.al. #include <inttypes.h> // for PRId64 et.al.
#endif #endif
#ifndef PRId64 #ifndef PRId64
 End of changes. 1 change blocks. 
7 lines changed or deleted 1 lines changed or added


 extensions.hpp   extensions.hpp 
skipping to change at line 404 skipping to change at line 404
// called after a choke message has been sent to the peer // called after a choke message has been sent to the peer
virtual void sent_unchoke() {} virtual void sent_unchoke() {}
// called when libtorrent think this peer should be disconne cted. // called when libtorrent think this peer should be disconne cted.
// if the plugin returns false, the peer will not be disconn ected. // if the plugin returns false, the peer will not be disconn ected.
virtual bool can_disconnect(error_code const& /*ec*/) { retu rn true; } virtual bool can_disconnect(error_code const& /*ec*/) { retu rn true; }
// called when an extended message is received. If returning true, // called when an extended message is received. If returning true,
// the message is not processed by any other plugin and if f alse // the message is not processed by any other plugin and if f alse
// is returned the next plugin in the chain will receive it to // is returned the next plugin in the chain will receive it to
// be able to handle it // be able to handle it. This is not called for web seeds.
// this is not called for web seeds // thus function may be called more than once per incoming m
essage, but
// only the last of the calls will the ``body`` size equal t
he ``length``.
// i.e. Every time another fragment of the message is receiv
ed, this
// function will be called, until finally the whole message
has been
// received. The purpose of this is to allow early disconnec
ts for invalid
// messages and for reporting progress of receiving large me
ssages.
virtual bool on_extended(int /*length*/, int /*msg*/, virtual bool on_extended(int /*length*/, int /*msg*/,
buffer::const_interval /*body*/) buffer::const_interval /*body*/)
{ return false; } { return false; }
// this is not called for web seeds // this is not called for web seeds
virtual bool on_unknown_message(int /*length*/, int /*msg*/, virtual bool on_unknown_message(int /*length*/, int /*msg*/,
buffer::const_interval /*body*/) buffer::const_interval /*body*/)
{ return false; } { return false; }
// called when a piece that this peer participated in either // called when a piece that this peer participated in either
 End of changes. 1 change blocks. 
2 lines changed or deleted 13 lines changed or added


 file_storage.hpp   file_storage.hpp 
skipping to change at line 240 skipping to change at line 240
// size. Everything necessary to interpret a regular bittorrent stor age // size. Everything necessary to interpret a regular bittorrent stor age
// file structure. // file structure.
class TORRENT_EXPORT file_storage class TORRENT_EXPORT file_storage
{ {
friend class torrent_info; friend class torrent_info;
public: public:
// hidden // hidden
file_storage(); file_storage();
// hidden // hidden
~file_storage(); ~file_storage();
file_storage(file_storage const& f);
file_storage& operator=(file_storage const&);
// returns true if the piece length has been initialized // returns true if the piece length has been initialized
// on the file_storage. This is typically taken as a proxy // on the file_storage. This is typically taken as a proxy
// of whether the file_storage as a whole is initialized or // of whether the file_storage as a whole is initialized or
// not. // not.
bool is_valid() const { return m_piece_length > 0; } bool is_valid() const { return m_piece_length > 0; }
// file attribute flags // file attribute flags
enum flags_t enum flags_t
{ {
skipping to change at line 331 skipping to change at line 333
#endif // TORRENT_USE_WSTRING #endif // TORRENT_USE_WSTRING
// returns a list of file_slice objects representing the por tions of // returns a list of file_slice objects representing the por tions of
// files the specified piece index, byte offset and size ran ge overlaps. // files the specified piece index, byte offset and size ran ge overlaps.
// this is the inverse mapping of map_file(). // this is the inverse mapping of map_file().
std::vector<file_slice> map_block(int piece, size_type offse t std::vector<file_slice> map_block(int piece, size_type offse t
, int size) const; , int size) const;
// returns a peer_request representing the piece index, byte offset // returns a peer_request representing the piece index, byte offset
// and size the specified file range overlaps. This is the i nverse // and size the specified file range overlaps. This is the i nverse
// mapping ove map_block(). // mapping ove map_block(). Note that the ``peer_request`` r
eturn type
// is meant to hold bittorrent block requests, which may not
be larger
// than 16 kiB. Mapping a range larger than that may return
an overflown
// integer.
peer_request map_file(int file, size_type offset, int size) const; peer_request map_file(int file, size_type offset, int size) const;
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
// all functions depending on internal_file_entry // all functions depending on internal_file_entry
// were deprecated in 1.0. Use the variants that take an // were deprecated in 1.0. Use the variants that take an
// index instead // index instead
typedef std::vector<internal_file_entry>::const_iterator ite rator; typedef std::vector<internal_file_entry>::const_iterator ite rator;
typedef std::vector<internal_file_entry>::const_reverse_iter ator reverse_iterator; typedef std::vector<internal_file_entry>::const_reverse_iter ator reverse_iterator;
TORRENT_DEPRECATED_PREFIX TORRENT_DEPRECATED_PREFIX
 End of changes. 2 change blocks. 
1 lines changed or deleted 9 lines changed or added


 ip_voter.hpp   ip_voter.hpp 
skipping to change at line 64 skipping to change at line 64
private: private:
bool maybe_rotate(); bool maybe_rotate();
struct external_ip_t struct external_ip_t
{ {
external_ip_t(): sources(0), num_votes(0) {} external_ip_t(): sources(0), num_votes(0) {}
bool add_vote(sha1_hash const& k, int type); bool add_vote(sha1_hash const& k, int type);
// we want to sort decending
bool operator<(external_ip_t const& rhs) const bool operator<(external_ip_t const& rhs) const
{ {
if (num_votes < rhs.num_votes) return true; if (num_votes > rhs.num_votes) return true;
if (num_votes > rhs.num_votes) return false; if (num_votes < rhs.num_votes) return false;
return sources < rhs.sources; return sources > rhs.sources;
} }
// this is a bloom filter of the IPs that have // this is a bloom filter of the IPs that have
// reported this address // reported this address
bloom_filter<16> voters; bloom_filter<16> voters;
// this is the actual external address // this is the actual external address
address addr; address addr;
// a bitmask of sources the reporters have come from // a bitmask of sources the reporters have come from
boost::uint16_t sources; boost::uint16_t sources;
// the total number of votes for this IP // the total number of votes for this IP
 End of changes. 2 change blocks. 
3 lines changed or deleted 5 lines changed or added


 peer_connection.hpp   peer_connection.hpp 
skipping to change at line 612 skipping to change at line 612
int send_buffer_capacity() const int send_buffer_capacity() const
{ return m_send_buffer.capacity(); } { return m_send_buffer.capacity(); }
int packet_size() const { return m_packet_size; } int packet_size() const { return m_packet_size; }
bool packet_finished() const bool packet_finished() const
{ return m_packet_size <= m_recv_pos; } { return m_packet_size <= m_recv_pos; }
int receive_pos() const { return m_recv_pos; } int receive_pos() const { return m_recv_pos; }
void max_out_request_queue(int s) void max_out_request_queue(int s);
{ m_max_out_request_queue = s; } int max_out_request_queue() const;
int max_out_request_queue() const
{ return m_max_out_request_queue; }
#ifdef TORRENT_DEBUG #ifdef TORRENT_DEBUG
bool piece_failed; bool piece_failed;
#endif #endif
time_t last_seen_complete() const { return m_last_seen_compl ete; } time_t last_seen_complete() const { return m_last_seen_compl ete; }
void set_last_seen_complete(int ago) { m_last_seen_complete = time(0) - ago; } void set_last_seen_complete(int ago) { m_last_seen_complete = time(0) - ago; }
size_type uploaded_in_last_round() const size_type uploaded_in_last_round() const
{ return m_statistics.total_payload_upload() - m_uploaded_at _last_round; } { return m_statistics.total_payload_upload() - m_uploaded_at _last_round; }
 End of changes. 1 change blocks. 
4 lines changed or deleted 2 lines changed or added


 torrent_handle.hpp   torrent_handle.hpp 
skipping to change at line 1291 skipping to change at line 1291
// the number of bytes downloaded and uploaded to all peers, accumulated, // the number of bytes downloaded and uploaded to all peers, accumulated,
// *this session* only. The session is considered to restart when a // *this session* only. The session is considered to restart when a
// torrent is paused and restarted again. When a torrent is paused, these // torrent is paused and restarted again. When a torrent is paused, these
// counters are reset to 0. If you want complete, persistent , stats, see // counters are reset to 0. If you want complete, persistent , stats, see
// ``all_time_upload`` and ``all_time_download``. // ``all_time_upload`` and ``all_time_download``.
size_type total_download; size_type total_download;
size_type total_upload; size_type total_upload;
// counts the amount of bytes send and received this session , but only // counts the amount of bytes send and received this session , but only
// the actual payload data (i.e the interesting data), these counters // the actual payload data (i.e the interesting data), these counters
// ignore any protocol overhead. // ignore any protocol overhead. The session is considered t
o restart
// when a torrent is paused and restarted again. When a torr
ent is
// paused, these counters are reset to 0.
size_type total_payload_download; size_type total_payload_download;
size_type total_payload_upload; size_type total_payload_upload;
// the number of bytes that has been downloaded and that has failed the // the number of bytes that has been downloaded and that has failed the
// piece hash test. In other words, this is just how much cr ap that has // piece hash test. In other words, this is just how much cr ap that has
// been downloaded. // been downloaded since the torrent was last started. If a
torrent is
// paused and then restarted again, this counter will be res
et.
size_type total_failed_bytes; size_type total_failed_bytes;
// the number of bytes that has been downloaded even though that data // the number of bytes that has been downloaded even though that data
// already was downloaded. The reason for this is that in so me situations // already was downloaded. The reason for this is that in so me situations
// the same data can be downloaded by mistake. When libtorre nt sends // the same data can be downloaded by mistake. When libtorre nt sends
// requests to a peer, and the peer doesn't send a response within a // requests to a peer, and the peer doesn't send a response within a
// certain timeout, libtorrent will re-request that block. A nother // certain timeout, libtorrent will re-request that block. A nother
// situation when libtorrent may re-request blocks is when t he requests // situation when libtorrent may re-request blocks is when t he requests
// it sends out are not replied in FIFO-order (it will re-re quest blocks // it sends out are not replied in FIFO-order (it will re-re quest blocks
// that are skipped by an out of order block). This is suppo sed to be as // that are skipped by an out of order block). This is suppo sed to be as
// low as possible. // low as possible. This only counts bytes since the torrent
was last
// started. If a torrent is paused and then restarted again,
this counter
// will be reset.
size_type total_redundant_bytes; size_type total_redundant_bytes;
// a bitmask that represents which pieces we have (set to tr ue) and the // a bitmask that represents which pieces we have (set to tr ue) and the
// pieces we don't have. It's a pointer and may be set to 0 if the // pieces we don't have. It's a pointer and may be set to 0 if the
// torrent isn't downloading or seeding. // torrent isn't downloading or seeding.
bitfield pieces; bitfield pieces;
// a bitmask representing which pieces has had their hash ch ecked. This // a bitmask representing which pieces has had their hash ch ecked. This
// only applies to torrents in *seed mode*. If the torrent i s not in seed // only applies to torrents in *seed mode*. If the torrent i s not in seed
// mode, this bitmask may be empty. // mode, this bitmask may be empty.
 End of changes. 3 change blocks. 
3 lines changed or deleted 14 lines changed or added


 udp_socket.hpp   udp_socket.hpp 
skipping to change at line 160 skipping to change at line 160
{ {
return m_v4_outstanding return m_v4_outstanding
#if TORRENT_USE_IPV6 #if TORRENT_USE_IPV6
+ m_v6_outstanding + m_v6_outstanding
#endif #endif
; ;
} }
private: private:
// non-copyable
udp_socket(udp_socket const&);
udp_socket& operator=(udp_socket const&);
// observers on this udp socket // observers on this udp socket
std::vector<udp_socket_observer*> m_observers; std::vector<udp_socket_observer*> m_observers;
std::vector<udp_socket_observer*> m_added_observers; std::vector<udp_socket_observer*> m_added_observers;
// this is true while iterating over the observers // this is true while iterating over the observers
// vector, invoking observer hooks. We may not // vector, invoking observer hooks. We may not
// add new observers during this time, since it // add new observers during this time, since it
// may invalidate the iterator. If this is true, // may invalidate the iterator. If this is true,
// instead add new observers to m_added_observers // instead add new observers to m_added_observers
// and they will be added later // and they will be added later
 End of changes. 1 change blocks. 
0 lines changed or deleted 4 lines changed or added


 version.hpp   version.hpp 
skipping to change at line 38 skipping to change at line 38
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef TORRENT_VERSION_HPP_INCLUDED #ifndef TORRENT_VERSION_HPP_INCLUDED
#define TORRENT_VERSION_HPP_INCLUDED #define TORRENT_VERSION_HPP_INCLUDED
#define LIBTORRENT_VERSION_MAJOR 1 #define LIBTORRENT_VERSION_MAJOR 1
#define LIBTORRENT_VERSION_MINOR 0 #define LIBTORRENT_VERSION_MINOR 0
#define LIBTORRENT_VERSION_TINY 4 #define LIBTORRENT_VERSION_TINY 5
// the format of this version is: MMmmtt // the format of this version is: MMmmtt
// M = Major version, m = minor version, t = tiny version // M = Major version, m = minor version, t = tiny version
#define LIBTORRENT_VERSION_NUM ((LIBTORRENT_VERSION_MAJOR * 10000) + (LIBTO RRENT_VERSION_MINOR * 100) + LIBTORRENT_VERSION_TINY) #define LIBTORRENT_VERSION_NUM ((LIBTORRENT_VERSION_MAJOR * 10000) + (LIBTO RRENT_VERSION_MINOR * 100) + LIBTORRENT_VERSION_TINY)
#define LIBTORRENT_VERSION "1.0.4.0" #define LIBTORRENT_VERSION "1.0.5.0"
#define LIBTORRENT_REVISION "$Rev: 10888 $" #define LIBTORRENT_REVISION "$Rev: 11072 $"
#endif #endif
 End of changes. 2 change blocks. 
3 lines changed or deleted 3 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/