reorder some more fields to reduce padding

This commit is contained in:
Arvid Norberg 2013-11-26 02:23:33 +00:00
parent 629baa3622
commit d03d50b6a8
5 changed files with 24 additions and 22 deletions

View File

@ -103,8 +103,8 @@ bool TORRENT_EXTRA_EXPORT verify_message(lazy_entry const* msg, key_desc_t const
// to remove stale peers
struct peer_entry
{
tcp::endpoint addr;
ptime added;
tcp::endpoint addr;
bool seed;
};

View File

@ -48,10 +48,10 @@ namespace libtorrent { namespace dht
struct node_entry
{
node_entry(node_id const& id_, udp::endpoint ep, int roundtriptime = 0xffff, bool pinged = false)
: endpoint(ep)
, timeout_count(pinged ? 0 : 0xff)
: id(id_)
, endpoint(ep)
, rtt(roundtriptime)
, id(id_)
, timeout_count(pinged ? 0 : 0xff)
{
#ifdef TORRENT_DHT_VERBOSE_LOGGING
first_seen = time_now();
@ -59,10 +59,10 @@ struct node_entry
}
node_entry(udp::endpoint ep)
: endpoint(ep)
, timeout_count(0xff)
: id(0)
, endpoint(ep)
, rtt(0xffff)
, id(0)
, timeout_count(0xff)
{
#ifdef TORRENT_DHT_VERBOSE_LOGGING
first_seen = time_now();
@ -70,9 +70,9 @@ struct node_entry
}
node_entry()
: timeout_count(0xff)
: id(0)
, rtt(0xffff)
, id(0)
, timeout_count(0xff)
{
#ifdef TORRENT_DHT_VERBOSE_LOGGING
first_seen = time_now();
@ -94,16 +94,20 @@ struct node_entry
address addr() const { return endpoint.address(); }
int port() const { return endpoint.port; }
union_endpoint endpoint;
// the number of times this node has failed to
// respond in a row
boost::uint8_t timeout_count;
// the average RTT of this node
boost::uint16_t rtt;
node_id id;
#ifdef TORRENT_DHT_VERBOSE_LOGGING
ptime first_seen;
#endif
node_id id;
union_endpoint endpoint;
// the average RTT of this node
boost::uint16_t rtt;
// the number of times this node has failed to
// respond in a row
boost::uint8_t timeout_count;
};
} } // namespace libtorrent::dht

View File

@ -181,11 +181,11 @@ private:
// port has to match
node_entry* find_node(udp::endpoint const& ep, routing_table::table_t::iterator* bucket);
dht_settings const& m_settings;
// constant called k in paper
int m_bucket_size;
dht_settings const& m_settings;
// (k-bucket, replacement cache) pairs
// the first entry is the bucket the furthest
// away from our own ID. Each time the bucket

View File

@ -111,10 +111,9 @@ private:
transactions_t m_transactions;
udp_socket_interface* m_sock;
node_id m_our_id;
routing_table& m_table;
ptime m_timer;
node_id m_random_number;
node_id m_our_id;
int m_allocated_observers;
bool m_destructing;
};

View File

@ -162,10 +162,9 @@ rpc_manager::rpc_manager(node_id const& our_id
, routing_table& table, udp_socket_interface* sock)
: m_pool_allocator(observer_size, 10)
, m_sock(sock)
, m_our_id(our_id)
, m_table(table)
, m_timer(time_now())
, m_random_number(generate_random_id())
, m_our_id(our_id)
, m_allocated_observers(0)
, m_destructing(false)
{