minor fixes

This commit is contained in:
Arvid Norberg 2013-08-01 16:15:02 +00:00
parent 93f9d4b3b0
commit d72f0017b1
3 changed files with 19 additions and 26 deletions

View File

@ -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

View File

@ -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
{

View File

@ -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<peer_disconnected_alert>(a))
if (alert_cast<tracker_reply_alert>(a))
++tracker_responses;
else if (alert_cast<peer_disconnected_alert>(a))
++peer_disconnects;
else if (alert_cast<peer_error_alert>(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<tracker_reply_alert>(a))
++tracker_responses;
if (alert_cast<peer_disconnected_alert>(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();