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:
parent
068adcd9a9
commit
abb174218b
|
@ -188,7 +188,7 @@ namespace libtorrent
|
||||||
struct TORRENT_EXPORT peer_error_alert: alert
|
struct TORRENT_EXPORT peer_error_alert: alert
|
||||||
{
|
{
|
||||||
peer_error_alert(tcp::endpoint const& pip, peer_id const& pid_, std::string const& msg)
|
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)
|
, ip(pip)
|
||||||
, pid(pid_)
|
, pid(pid_)
|
||||||
{}
|
{}
|
||||||
|
@ -200,6 +200,21 @@ namespace libtorrent
|
||||||
peer_id pid;
|
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
|
struct TORRENT_EXPORT invalid_request_alert: torrent_alert
|
||||||
{
|
{
|
||||||
invalid_request_alert(
|
invalid_request_alert(
|
||||||
|
|
|
@ -247,7 +247,7 @@ namespace libtorrent
|
||||||
|
|
||||||
void timed_out();
|
void timed_out();
|
||||||
// this will cause this peer_connection to be disconnected.
|
// 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; }
|
bool is_disconnecting() const { return m_disconnecting; }
|
||||||
|
|
||||||
// this is called when the connection attempt has succeeded
|
// this is called when the connection attempt has succeeded
|
||||||
|
@ -293,7 +293,6 @@ namespace libtorrent
|
||||||
bool ignore_bandwidth_limits() const
|
bool ignore_bandwidth_limits() const
|
||||||
{ return m_ignore_bandwidth_limits; }
|
{ return m_ignore_bandwidth_limits; }
|
||||||
|
|
||||||
void set_failed() { m_failed = true; }
|
|
||||||
bool failed() const { return m_failed; }
|
bool failed() const { return m_failed; }
|
||||||
|
|
||||||
int desired_queue_size() const { return m_desired_queue_size; }
|
int desired_queue_size() const { return m_desired_queue_size; }
|
||||||
|
|
Loading…
Reference in New Issue