forked from premiere/premiere-libtorrent
fix uTP bug
This commit is contained in:
parent
4d60adcaa9
commit
c8f7b79e2b
|
@ -101,6 +101,9 @@ namespace libtorrent
|
|||
private:
|
||||
void** m_storage;
|
||||
std::size_t m_capacity;
|
||||
|
||||
// this is the total number of elements that are occupied
|
||||
// in the array
|
||||
std::size_t m_size;
|
||||
|
||||
// This defines the first index that is part of the m_storage.
|
||||
|
|
|
@ -123,10 +123,10 @@ namespace libtorrent {
|
|||
void* old_value = m_storage[idx & (m_capacity - 1)];
|
||||
m_storage[idx & (m_capacity - 1)] = value;
|
||||
|
||||
if (m_size++ == 0)
|
||||
{
|
||||
m_first = idx;
|
||||
}
|
||||
if (m_size == 0) m_first = idx;
|
||||
// if we're just replacing an old value, the number
|
||||
// of elements in the buffer doesn't actually increase
|
||||
if (old_value == 0) ++m_size;
|
||||
|
||||
TORRENT_ASSERT_VAL(m_first <= 0xffff, m_first);
|
||||
return old_value;
|
||||
|
|
Loading…
Reference in New Issue