fixed rate limit bug for DHT

This commit is contained in:
Arvid Norberg
2010-07-28 18:43:56 +00:00
parent ef48c92a4e
commit f27e24ba98
2 changed files with 3 additions and 1 deletions

View File

@@ -772,9 +772,10 @@ void rate_limited_udp_socket::on_tick(error_code const& e)
if (m_queue.empty()) return;
while (!m_queue.empty() && int(m_queue.front().buf.size()) >= m_quota)
while (!m_queue.empty() && int(m_queue.front().buf.size()) <= m_quota)
{
queued_packet const& p = m_queue.front();
TORRENT_ASSERT(m_quota >= p.buf.size());
m_quota -= p.buf.size();
error_code ec;
udp_socket::send(p.ep, &p.buf[0], p.buf.size(), ec);