post alerts for socks failures. fix unit tests

This commit is contained in:
Arvid Norberg
2010-08-25 06:22:49 +00:00
parent 58574c236a
commit b44f71e217
5 changed files with 45 additions and 30 deletions

View File

@@ -90,15 +90,18 @@ bool print_alerts(libtorrent::session& ses, char const* name
}
TEST_CHECK(alert_cast<fastresume_rejected_alert>(a.get()) == 0 || allow_failed_fastresume);
TEST_CHECK(alert_cast<peer_error_alert>(a.get()) == 0
peer_error_alert* pea = alert_cast<peer_error_alert>(a.get());
TEST_CHECK(pea == 0
|| (!handles.empty() && h.is_seed())
|| a->message() == "connecting to peer"
|| a->message() == "closing connection to ourself"
|| a->message() == "duplicate connection"
|| a->message() == "duplicate peer-id, connection closed"
|| (allow_disconnects && a->message() == "Broken pipe")
|| (allow_disconnects && a->message() == "Connection reset by peer")
|| (allow_disconnects && a->message() == "End of file."));
|| pea->error.message() == "connecting to peer"
|| pea->error.message() == "closing connection to ourself"
|| pea->error.message() == "duplicate connection"
|| pea->error.message() == "duplicate peer-id"
|| pea->error.message() == "upload to upload connection"
|| pea->error.message() == "stopping torrent"
|| (allow_disconnects && pea->error.message() == "Broken pipe")
|| (allow_disconnects && pea->error.message() == "Connection reset by peer")
|| (allow_disconnects && pea->error.message() == "End of file."));
a = ses.pop_alert();
}
return ret;

View File

@@ -277,8 +277,8 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe
#ifndef TORRENT_DISABLE_ENCRYPTION
pe_settings pes;
pes.out_enc_policy = pe_settings::forced;
pes.in_enc_policy = pe_settings::forced;
pes.out_enc_policy = pe_settings::disabled;
pes.in_enc_policy = pe_settings::disabled;
ses1.set_pe_settings(pes);
ses2.set_pe_settings(pes);
#endif
@@ -322,7 +322,7 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe
ses2.set_alert_mask(alert::all_categories
& ~alert::progress_notification
& ~alert::stats_notification);
ses1.set_alert_dispatch(&print_alert);
// ses1.set_alert_dispatch(&print_alert);
ses2.set_download_rate_limit(tor2.get_torrent_info().piece_length() * 5);
@@ -380,7 +380,7 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe
}
// 1 announce per tracker to start
TEST_EQUAL(tracker_responses, 2);
TEST_CHECK(tracker_responses >= 2);
TEST_CHECK(!tor2.is_seed());
TEST_CHECK(tor2.is_finished());