attempt to memory optimization in DHT routing table

This commit is contained in:
Arvid Norberg 2007-05-08 08:49:07 +00:00
parent ceb442bea0
commit 122841fc5e
2 changed files with 3 additions and 2 deletions

View File

@ -57,7 +57,7 @@ using asio::ip::udp;
//TORRENT_DECLARE_LOG(table);
typedef std::deque<node_entry> bucket_t;
typedef std::vector<node_entry> bucket_t;
// differences in the implementation from the description in
// the paper:
@ -101,7 +101,7 @@ namespace aux
, bucket_iterator_t end)
: m_bucket_iterator(begin)
, m_bucket_end(end)
, m_iterator(begin != end ? begin->first.begin() : bucket_t::iterator())
, m_iterator(begin != end ? begin->first.begin() : bucket_t::const_iterator())
{
if (m_bucket_iterator == m_bucket_end) return;
while (m_iterator == m_bucket_iterator->first.end())

View File

@ -265,6 +265,7 @@ bool routing_table::node_seen(node_id const& id, udp::endpoint addr)
// offline
if ((int)b.size() < m_bucket_size)
{
if (b.empty()) b.reserve(m_bucket_size);
b.push_back(node_entry(id, addr));
// if bucket index is 0, the node is ourselves
// don't updated m_lowest_active_bucket