added incoming lsd alert

This commit is contained in:
Arvid Norberg 2010-07-15 05:56:29 +00:00
parent aa25ed00c6
commit b3f57ac293
5 changed files with 38 additions and 0 deletions

View File

@ -1,3 +1,4 @@
* added alert for incoming local service discovery messages
* added option to set file priorities when adding torrents
* removed the session mutex for improved performance
* added upload and download activity timer stats for torrents

View File

@ -5875,6 +5875,20 @@ This alert is generated when a block request receives a response.
};
lsd_peer_alert
--------------
This alert is generated when we receive a local service discovery message from a peer
for a torrent we're currently participating in.
::
struct lsd_peer_alert: peer_alert
{
// ...
};
file_completed_alert
--------------------

View File

@ -1154,6 +1154,19 @@ namespace libtorrent
std::string str;
};
struct TORRENT_EXPORT lsd_peer_alert: peer_alert
{
lsd_peer_alert(torrent_handle const& h
, tcp::endpoint const& ip_)
: peer_alert(h, ip_, peer_id(0))
{}
TORRENT_DEFINE_ALERT(lsd_peer_alert);
const static int static_category = alert::peer_notification;
virtual std::string message() const;
};
}

View File

@ -477,5 +477,13 @@ namespace libtorrent {
return msg;
}
std::string lsd_peer_alert::message() const
{
char msg[200];
snprintf(msg, sizeof(msg), "%s: received peer from local service discovery"
, peer_alert::message().c_str());
return msg;
}
} // namespace libtorrent

View File

@ -3300,6 +3300,8 @@ namespace aux {
<< ": added peer from local discovery: " << peer << "\n";
#endif
t->get_policy().add_peer(peer, peer_id(0), peer_info::lsd, 0);
if (m_alerts.should_post<lsd_peer_alert>())
m_alerts.post_alert(lsd_peer_alert(t->get_handle(), peer));
}
void session_impl::on_port_map_log(