From d72f0017b1f9e6624fba67b5f2cb7669d660a174 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Thu, 1 Aug 2013 16:15:02 +0000 Subject: [PATCH] minor fixes --- docs/makefile | 2 +- include/libtorrent/time.hpp | 1 + test/test_transfer.cpp | 42 +++++++++++++++---------------------- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/docs/makefile b/docs/makefile index b54dccd24..00a0258ea 100644 --- a/docs/makefile +++ b/docs/makefile @@ -72,5 +72,5 @@ reference.rst:gen_reference_doc.py ../include/libtorrent/*.hpp cp $@ $(WEB_PATH)/$@ clean: - rm -f $(TARGETS:=.html) $(TARGETS:=.pdf) todo.html reference*.html + rm -f $(TARGETS:=.html) $(TARGETS:=.pdf) todo.html reference*.html reference*.rst diff --git a/include/libtorrent/time.hpp b/include/libtorrent/time.hpp index 4285a09ac..9aea516b7 100644 --- a/include/libtorrent/time.hpp +++ b/include/libtorrent/time.hpp @@ -56,6 +56,7 @@ POSSIBILITY OF SUCH DAMAGE. // .. note:: // In a future version of libtorrent, these types will be replaced // by the standard timer types from ``std::chrono``. +// namespace libtorrent { diff --git a/test/test_transfer.cpp b/test/test_transfer.cpp index 5509de180..eb7a6d3ef 100644 --- a/test/test_transfer.cpp +++ b/test/test_transfer.cpp @@ -55,12 +55,17 @@ int const alert_mask = alert::all_categories int peer_disconnects = 0; -bool predicate(alert* a) +int tracker_responses = 0; + +bool on_alert(alert* a) { - if (alert_cast(a)) + if (alert_cast(a)) + ++tracker_responses; + else if (alert_cast(a)) ++peer_disconnects; else if (alert_cast(a)) ++peer_disconnects; + return false; } @@ -97,8 +102,8 @@ void test_rate() for (int i = 0; i < 70; ++i) { - print_alerts(ses1, "ses1", true, true, true, &predicate); - print_alerts(ses2, "ses2", true, true, true, &predicate); + print_alerts(ses1, "ses1", true, true, true, &on_alert); + print_alerts(ses2, "ses2", true, true, true, &on_alert); torrent_status st1 = tor1.status(); torrent_status st2 = tor2.status(); @@ -228,19 +233,6 @@ storage_interface* test_storage_constructor(file_storage const& fs return new test_storage(fs, path, fp); } -int tracker_responses = 0; - -bool on_alert(alert* a) -{ - if (alert_cast(a)) - ++tracker_responses; - - if (alert_cast(a)) - ++peer_disconnects; - - return false; -} - void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowed_fast = false, bool test_priorities = false) { @@ -375,8 +367,8 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe for (int i = 0; i < 50; ++i) { - print_alerts(ses1, "ses1", true, true, true, on_alert); - print_alerts(ses2, "ses2", true, true, true, on_alert); + print_alerts(ses1, "ses1", true, true, true, &on_alert); + print_alerts(ses2, "ses2", true, true, true, &on_alert); torrent_status st1 = tor1.status(); torrent_status st2 = tor2.status(); @@ -446,7 +438,7 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe for (int i = 0; i < 50; ++i) { test_sleep(100); - print_alerts(ses2, "ses2", true, true, true, on_alert); + print_alerts(ses2, "ses2", true, true, true, &on_alert); torrent_status st2 = tor2.status(); if (i % 10 == 0) @@ -461,7 +453,7 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe for (int i = 0; i < 5; ++i) { - print_alerts(ses2, "ses2", true, true, true, on_alert); + print_alerts(ses2, "ses2", true, true, true, &on_alert); torrent_status st2 = tor2.status(); TEST_CHECK(st2.state == torrent_status::finished); test_sleep(100); @@ -537,8 +529,8 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe for (int i = 0; i < 5; ++i) { - print_alerts(ses1, "ses1", true, true, true, on_alert); - print_alerts(ses2, "ses2", true, true, true, on_alert); + print_alerts(ses1, "ses1", true, true, true, &on_alert); + print_alerts(ses2, "ses2", true, true, true, &on_alert); torrent_status st1 = tor1.status(); torrent_status st2 = tor2.status(); @@ -557,8 +549,8 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe for (int i = 0; i < 130; ++i) { - print_alerts(ses1, "ses1", true, true, true, on_alert); - print_alerts(ses2, "ses2", true, true, true, on_alert); + print_alerts(ses1, "ses1", true, true, true, &on_alert); + print_alerts(ses2, "ses2", true, true, true, &on_alert); torrent_status st1 = tor1.status(); torrent_status st2 = tor2.status();