diff --git a/ChangeLog b/ChangeLog index f0f3c3aef..d7c7f4a74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,7 @@ 1.1.1 release + * fixed dht stats counters that weren't being updated * make sure add_torrent_alert is always posted before other alerts for the torrent * fixed peer-class leak when settings per-torrent rate limits diff --git a/include/libtorrent/error_code.hpp b/include/libtorrent/error_code.hpp index 35df86039..d117fcaae 100644 --- a/include/libtorrent/error_code.hpp +++ b/include/libtorrent/error_code.hpp @@ -50,6 +50,10 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/aux_/disable_warnings_pop.hpp" +#ifndef BOOST_SYSTEM_NOEXCEPT +#define BOOST_SYSTEM_NOEXCEPT TORRENT_EXCEPTION_THROW_SPECIFIER +#endif + namespace libtorrent { diff --git a/simulation/test_dht.cpp b/simulation/test_dht.cpp index f74765c79..3d00b88b9 100644 --- a/simulation/test_dht.cpp +++ b/simulation/test_dht.cpp @@ -39,6 +39,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/settings_pack.hpp" #include "libtorrent/session_settings.hpp" #include "libtorrent/session.hpp" +#include "libtorrent/session_stats.hpp" #include "libtorrent/alert_types.hpp" #include "libtorrent/deadline_timer.hpp" #include "libtorrent/socket_io.hpp" @@ -126,6 +127,11 @@ TORRENT_TEST(dht_bootstrap) num_nodes = c; print_routing_table(p->routing_table); } + else if (lt::session_stats_alert const* sa = lt::alert_cast(a)) + { + int const dht_nodes = lt::find_metric_idx("dht.nodes"); + TEST_CHECK(sa->values[dht_nodes] > 2); + } } // terminate? , [&](int ticks, lt::session& ses) -> bool @@ -136,6 +142,7 @@ TORRENT_TEST(dht_bootstrap) } if (ticks > 2) { + ses.post_session_stats(); std::printf("depth: %d nodes: %d\n", routing_table_depth, num_nodes); TEST_CHECK(routing_table_depth >= 9); TEST_CHECK(num_nodes >= 115); diff --git a/src/kademlia/node.cpp b/src/kademlia/node.cpp index d5863c1eb..f90ad5b6f 100644 --- a/src/kademlia/node.cpp +++ b/src/kademlia/node.cpp @@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include // for PRId64 et.al. #include +#include #include #ifdef TORRENT_USE_VALGRIND @@ -751,6 +752,12 @@ void node::update_stats_counters(counters& c) const c.set_value(counters::dht_peers, dht_cnt.peers); c.set_value(counters::dht_immutable_data, dht_cnt.immutable_data); c.set_value(counters::dht_mutable_data, dht_cnt.mutable_data); + + int nodes, replacements; + boost::tie(nodes, replacements, boost::tuples::ignore) = size(); + c.set_value(counters::dht_nodes, nodes); + c.set_value(counters::dht_node_cache, replacements); + c.set_value(counters::dht_allocated_observers, m_rpc.num_allocated_observers()); } #ifndef TORRENT_NO_DEPRECATE diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index b00386166..26d577c28 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -404,7 +404,7 @@ namespace libtorrent m_socket->async_connect(m_remote , boost::bind(&peer_connection::on_connection_complete, self(), _1)); - m_connect = clock_type::now(); + m_connect = aux::time_now(); sent_syn(m_remote.address().is_v6()); @@ -4092,7 +4092,7 @@ namespace libtorrent , boost::asio::error::get_misc_category()) && !in_handshake() && !is_connecting() - && clock_type::now() - connected_time() < seconds(15)) + && aux::time_now() - connected_time() < seconds(15)) { peer_log(peer_log_alert::info, "SHORT_LIVED_DISCONNECT", ""); } diff --git a/test/Jamfile b/test/Jamfile index bbe0e57e0..3117aaf49 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -38,12 +38,12 @@ rule link_libtorrent ( properties * ) if shared in $(properties) { result += - /torrent//torrent/shared/on/shared/on/on ; + /torrent//torrent/shared/shared/on ; } else { result += - /torrent//torrent/static/on/static/on/on ; + /torrent//torrent/static/static/on ; } return $(result) ; } @@ -83,8 +83,6 @@ lib libtorrent_test : # user-requirements shared:TORRENT_LINK_TEST_SHARED - on - on . ; diff --git a/test/test_session.cpp b/test/test_session.cpp index a1c8a21f3..3abf0d13e 100644 --- a/test/test_session.cpp +++ b/test/test_session.cpp @@ -60,7 +60,6 @@ TORRENT_TEST(session) // verify that we get the appropriate performance warning because // we're allowing a larger queue than we have cache. - alert const* a; for (;;) { @@ -175,6 +174,7 @@ TORRENT_TEST(session_stats) TEST_EQUAL(stats[i].value_index, i); } } + template void test_save_restore(Set setup, Save s, Default d, Load l) {