fixed small memory leak in DHT

This commit is contained in:
Arvid Norberg 2011-11-28 11:11:29 +00:00
parent 27b25017f2
commit c4dded04ca
4 changed files with 10 additions and 7 deletions

View File

@ -99,6 +99,10 @@
incoming connection
* added more detailed instrumentation of the disk I/O thread
* fixed small memory leak in DHT
0.15.9 release
* added some functions missing from the python binding
* fixed rare piece picker bug
* fixed invalid torrent_status::finished_time

View File

@ -112,7 +112,6 @@ namespace libtorrent { namespace dht
void refresh_timeout(error_code const& e);
void tick(error_code const& e);
void on_bootstrap(std::vector<std::pair<node_entry, std::string> > const&);
bool send_packet(libtorrent::entry& e, udp::endpoint const& addr, int send_flags);
node_impl m_dht;

View File

@ -3161,7 +3161,9 @@ namespace libtorrent
{
char hex_pid[41];
to_hex(recv_buffer.begin, 20, hex_pid);
hex_pid[40] = 0;
char ascii_pid[21];
ascii_pid[20] = 0;
for (int i = 0; i != 20; ++i)
{
if (is_print(recv_buffer.begin[i])) ascii_pid[i] = recv_buffer.begin[i];

View File

@ -250,6 +250,9 @@ namespace libtorrent { namespace dht
#endif
}
// defined in node.cpp
extern void nop();
void dht_tracker::start(entry const& bootstrap)
{
TORRENT_ASSERT(m_ses.is_network_thread());
@ -273,7 +276,7 @@ namespace libtorrent { namespace dht
m_refresh_timer.expires_from_now(seconds(5), ec);
m_refresh_timer.async_wait(boost::bind(&dht_tracker::refresh_timeout, self(), _1));
m_dht.bootstrap(initial_nodes, boost::bind(&dht_tracker::on_bootstrap, self(), _1));
m_dht.bootstrap(initial_nodes, boost::bind(&libtorrent::dht::nop));
}
void dht_tracker::stop()
@ -607,11 +610,6 @@ namespace libtorrent { namespace dht
m_dht.add_router_node(node);
}
void dht_tracker::on_bootstrap(std::vector<std::pair<node_entry, std::string> > const&)
{
// #error post an alert
}
bool dht_tracker::send_packet(libtorrent::entry& e, udp::endpoint const& addr, int send_flags)
{
TORRENT_ASSERT(m_ses.is_network_thread());