forked from premiere/premiere-libtorrent
fix peer class leak in torrent and widen peer_class_t to allow for mo… (#707)
fix peer class leak in torrent and widen peer_class_t to allow for more instances
This commit is contained in:
parent
29943ab0f0
commit
8922990fc7
|
@ -47,7 +47,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
typedef boost::uint8_t peer_class_t;
|
typedef boost::uint16_t peer_class_t;
|
||||||
|
|
||||||
struct peer_class_info
|
struct peer_class_info
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,7 +87,7 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(m_peer_classes.size() < 0x100);
|
TORRENT_ASSERT(m_peer_classes.size() < 0x10000);
|
||||||
ret = peer_class_t(m_peer_classes.size());
|
ret = peer_class_t(m_peer_classes.size());
|
||||||
m_peer_classes.push_back(boost::shared_ptr<peer_class>());
|
m_peer_classes.push_back(boost::shared_ptr<peer_class>());
|
||||||
}
|
}
|
||||||
|
|
|
@ -876,6 +876,7 @@ namespace libtorrent
|
||||||
// this means that the invariant check that this is called from the
|
// this means that the invariant check that this is called from the
|
||||||
// network thread cannot be maintained
|
// network thread cannot be maintained
|
||||||
|
|
||||||
|
TORRENT_ASSERT(m_peer_class == 0);
|
||||||
TORRENT_ASSERT(m_abort);
|
TORRENT_ASSERT(m_abort);
|
||||||
TORRENT_ASSERT(m_connections.empty());
|
TORRENT_ASSERT(m_connections.empty());
|
||||||
if (!m_connections.empty())
|
if (!m_connections.empty())
|
||||||
|
@ -4719,6 +4720,12 @@ namespace libtorrent
|
||||||
update_gauge();
|
update_gauge();
|
||||||
stop_announcing();
|
stop_announcing();
|
||||||
|
|
||||||
|
if (m_peer_class > 0)
|
||||||
|
{
|
||||||
|
m_ses.peer_classes().decref(m_peer_class);
|
||||||
|
m_peer_class = 0;
|
||||||
|
}
|
||||||
|
|
||||||
error_code ec;
|
error_code ec;
|
||||||
m_inactivity_timer.cancel(ec);
|
m_inactivity_timer.cancel(ec);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue