diff --git a/include/libtorrent/http_seed_connection.hpp b/include/libtorrent/http_seed_connection.hpp index 087b1347d..17f51daa5 100644 --- a/include/libtorrent/http_seed_connection.hpp +++ b/include/libtorrent/http_seed_connection.hpp @@ -90,8 +90,6 @@ namespace libtorrent , policy::peer* peerinfo); void start(); - ~http_seed_connection(); - virtual int type() const { return peer_connection::http_seed_connection; } // called from the main loop when this connection has any @@ -105,6 +103,7 @@ namespace libtorrent virtual void get_specific_peer_info(peer_info& p) const; virtual bool in_handshake() const; + virtual void disconnect(error_code const& ec, int error = 0); // the following functions appends messages // to the send buffer diff --git a/include/libtorrent/peer_connection.hpp b/include/libtorrent/peer_connection.hpp index 7de9dc4e2..17f67192c 100644 --- a/include/libtorrent/peer_connection.hpp +++ b/include/libtorrent/peer_connection.hpp @@ -329,7 +329,7 @@ namespace libtorrent void on_timeout(); // this will cause this peer_connection to be disconnected. - void disconnect(error_code const& ec, int error = 0); + virtual void disconnect(error_code const& ec, int error = 0); bool is_disconnecting() const { return m_disconnecting; } // this is called when the connection attempt has succeeded diff --git a/include/libtorrent/web_peer_connection.hpp b/include/libtorrent/web_peer_connection.hpp index 8e4ea1813..0c0860137 100644 --- a/include/libtorrent/web_peer_connection.hpp +++ b/include/libtorrent/web_peer_connection.hpp @@ -88,8 +88,6 @@ namespace libtorrent , policy::peer* peerinfo); void start(); - ~web_peer_connection(); - virtual int type() const { return peer_connection::url_seed_connection; } // called from the main loop when this connection has any @@ -103,6 +101,7 @@ namespace libtorrent virtual void get_specific_peer_info(peer_info& p) const; virtual bool in_handshake() const; + virtual void disconnect(error_code const& ec, int error = 0); // the following functions appends messages // to the send buffer diff --git a/src/http_seed_connection.cpp b/src/http_seed_connection.cpp index 656d6f655..2d3366f2a 100644 --- a/src/http_seed_connection.cpp +++ b/src/http_seed_connection.cpp @@ -113,9 +113,11 @@ namespace libtorrent peer_connection::start(); } - http_seed_connection::~http_seed_connection() + void http_seed_connection::disconnect(error_code const& ec, int error) { boost::shared_ptr t = associated_torrent().lock(); + TORRENT_ASSERT(t); + peer_connection::disconnect(ec, error); if (t) t->disconnect_web_seed(m_url, web_seed_entry::http_seed); } diff --git a/src/web_peer_connection.cpp b/src/web_peer_connection.cpp index ed0e6f87f..d15f35a89 100644 --- a/src/web_peer_connection.cpp +++ b/src/web_peer_connection.cpp @@ -118,9 +118,11 @@ namespace libtorrent peer_connection::start(); } - web_peer_connection::~web_peer_connection() + void web_peer_connection::disconnect(error_code const& ec, int error) { boost::shared_ptr t = associated_torrent().lock(); + TORRENT_ASSERT(t); + peer_connection::disconnect(ec, error); if (t) t->disconnect_web_seed(m_original_url, web_seed_entry::url_seed); }