updated disconnect logic (also in [2279]). Introduced new peer_disconnect_alert used for normal disconnects and peer_error_alert is now used for protocol level errors

This commit is contained in:
Arvid Norberg 2008-05-12 06:05:13 +00:00
parent 068adcd9a9
commit abb174218b
2 changed files with 17 additions and 3 deletions

View File

@ -188,7 +188,7 @@ namespace libtorrent
struct TORRENT_EXPORT peer_error_alert: alert
{
peer_error_alert(tcp::endpoint const& pip, peer_id const& pid_, std::string const& msg)
: alert(alert::debug, msg)
: alert(alert::info, msg)
, ip(pip)
, pid(pid_)
{}
@ -200,6 +200,21 @@ namespace libtorrent
peer_id pid;
};
struct TORRENT_EXPORT peer_disconnected_alert: alert
{
peer_disconnected_alert(tcp::endpoint const& pip, peer_id const& pid_, std::string const& msg)
: alert(alert::debug, msg)
, ip(pip)
, pid(pid_)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new peer_disconnected_alert(*this)); }
tcp::endpoint ip;
peer_id pid;
};
struct TORRENT_EXPORT invalid_request_alert: torrent_alert
{
invalid_request_alert(

View File

@ -247,7 +247,7 @@ namespace libtorrent
void timed_out();
// this will cause this peer_connection to be disconnected.
void disconnect(char const* message);
void disconnect(char const* message, int error = 0);
bool is_disconnecting() const { return m_disconnecting; }
// this is called when the connection attempt has succeeded
@ -293,7 +293,6 @@ namespace libtorrent
bool ignore_bandwidth_limits() const
{ return m_ignore_bandwidth_limits; }
void set_failed() { m_failed = true; }
bool failed() const { return m_failed; }
int desired_queue_size() const { return m_desired_queue_size; }