merge test_ssl fix from RC_0_16

This commit is contained in:
Arvid Norberg 2013-08-02 01:12:27 +00:00
parent d72f0017b1
commit 990275d2dc
2 changed files with 8 additions and 3 deletions

View File

@ -198,6 +198,7 @@ bool print_alerts(libtorrent::session& ses, char const* name
|| 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() == "no shared cipher")
|| (allow_disconnects && pea->error.message() == "End of file."));
}
delete *i;

View File

@ -76,10 +76,12 @@ test_config_t test_config[] =
int peer_disconnects = 0;
bool predicate(alert* a)
bool on_alert(alert* a)
{
if (alert_cast<peer_disconnected_alert>(a))
++peer_disconnects;
if (alert_cast<peer_error_alert>(a))
++peer_disconnects;
return false;
}
@ -142,8 +144,8 @@ void test_ssl(int test_idx)
for (int i = 0; i < 15; ++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();
@ -184,6 +186,8 @@ void test_ssl(int test_idx)
test_sleep(100);
}
fprintf(stderr, "%s: EXPECT: %s\n", time_now_string(), test.expected_to_complete ? "SUCCEESS" : "FAILURE");
fprintf(stderr, "%s: RESULT: %s\n", time_now_string(), tor2.status().is_seeding ? "SUCCEESS" : "FAILURE");
TEST_CHECK(tor2.status().is_seeding == test.expected_to_complete);
}