added a unwanted_block_alert
This commit is contained in:
parent
5c749bcb3c
commit
55a944c014
|
@ -638,6 +638,29 @@ namespace libtorrent
|
|||
}
|
||||
};
|
||||
|
||||
struct TORRENT_EXPORT unwanted_block_alert: peer_alert
|
||||
{
|
||||
unwanted_block_alert(const torrent_handle& h, tcp::endpoint const& ip
|
||||
, peer_id const& pid, int block_num, int piece_num)
|
||||
: peer_alert(h, ip, pid)
|
||||
, block_index(block_num)
|
||||
, piece_index(piece_num)
|
||||
{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}
|
||||
|
||||
int block_index;
|
||||
int piece_index;
|
||||
|
||||
virtual std::auto_ptr<alert> clone() const
|
||||
{ return std::auto_ptr<alert>(new unwanted_block_alert(*this)); }
|
||||
virtual char const* what() const { return "unwanted block received"; }
|
||||
virtual std::string message() const
|
||||
{
|
||||
return peer_alert::message() + " received block not in download queue ( piece: "
|
||||
+ boost::lexical_cast<std::string>(piece_index) + " block: "
|
||||
+ boost::lexical_cast<std::string>(block_index) + ")";
|
||||
}
|
||||
};
|
||||
|
||||
struct TORRENT_EXPORT storage_moved_alert: torrent_alert
|
||||
{
|
||||
storage_moved_alert(torrent_handle const& h, std::string const& path_)
|
||||
|
|
|
@ -1523,8 +1523,8 @@ namespace libtorrent
|
|||
{
|
||||
if (t->alerts().should_post<peer_error_alert>())
|
||||
{
|
||||
t->alerts().post_alert(peer_error_alert(t->get_handle(), m_remote
|
||||
, m_peer_id, "got a block that was not in the request queue"));
|
||||
t->alerts().post_alert(unwanted_block_alert(t->get_handle(), m_remote
|
||||
, m_peer_id, block_finished.block_index, block_finished.piece_index));
|
||||
}
|
||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING
|
||||
(*m_logger) << " *** The block we just got was not in the "
|
||||
|
|
Loading…
Reference in New Issue