fix torrent peer class index overflow (#1557)

fix peer class index width
This commit is contained in:
Falcosc 2017-01-17 00:20:43 +01:00 committed by Arvid Norberg
parent 3b9c65daf1
commit a07ffe42f8
3 changed files with 3 additions and 1 deletions

View File

@ -1,3 +1,4 @@
* fix per-torrent rate limits for >256 peer classes
* don't load user_agent and peer_fingerprint from session_state * don't load user_agent and peer_fingerprint from session_state
* fix file rename issue with name prefix matching torrent name * fix file rename issue with name prefix matching torrent name
* fix division by zero when setting tick_interval > 1000 * fix division by zero when setting tick_interval > 1000

View File

@ -47,7 +47,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent namespace libtorrent
{ {
typedef boost::uint8_t peer_class_t; typedef boost::uint32_t peer_class_t;
struct peer_class_info struct peer_class_info
{ {

View File

@ -87,6 +87,7 @@ namespace libtorrent
} }
else else
{ {
TORRENT_ASSERT(m_peer_classes.size() < 0x100000000);
ret = m_peer_classes.size(); ret = m_peer_classes.size();
m_peer_classes.push_back(boost::shared_ptr<peer_class>()); m_peer_classes.push_back(boost::shared_ptr<peer_class>());
} }