forked from premiere/premiere-libtorrent
made the tests build again
This commit is contained in:
parent
f7042ca84a
commit
a7ed5578b6
|
@ -62,23 +62,23 @@ void print_alerts(libtorrent::session& ses, char const* name, bool allow_disconn
|
||||||
{
|
{
|
||||||
if (peer_disconnected_alert* p = dynamic_cast<peer_disconnected_alert*>(a.get()))
|
if (peer_disconnected_alert* p = dynamic_cast<peer_disconnected_alert*>(a.get()))
|
||||||
{
|
{
|
||||||
std::cerr << name << "(" << p->ip << "): " << p->msg() << "\n";
|
std::cerr << name << "(" << p->ip << "): " << p->message() << "\n";
|
||||||
}
|
}
|
||||||
else if (a->msg() != "block downloading"
|
else if (a->message() != "block downloading"
|
||||||
&& a->msg() != "block finished"
|
&& a->message() != "block finished"
|
||||||
&& a->msg() != "piece finished")
|
&& a->message() != "piece finished")
|
||||||
{
|
{
|
||||||
std::cerr << name << ": " << a->msg() << "\n";
|
std::cerr << name << ": " << a->message() << "\n";
|
||||||
}
|
}
|
||||||
TEST_CHECK(dynamic_cast<peer_error_alert*>(a.get()) == 0
|
TEST_CHECK(dynamic_cast<peer_error_alert*>(a.get()) == 0
|
||||||
|| (!handles.empty() && h.is_seed())
|
|| (!handles.empty() && h.is_seed())
|
||||||
|| a->msg() == "connecting to peer"
|
|| a->message() == "connecting to peer"
|
||||||
|| a->msg() == "closing connection to ourself"
|
|| a->message() == "closing connection to ourself"
|
||||||
|| a->msg() == "duplicate connection"
|
|| a->message() == "duplicate connection"
|
||||||
|| a->msg() == "duplicate peer-id, connection closed"
|
|| a->message() == "duplicate peer-id, connection closed"
|
||||||
|| (allow_disconnects && a->msg() == "Broken pipe")
|
|| (allow_disconnects && a->message() == "Broken pipe")
|
||||||
|| (allow_disconnects && a->msg() == "Connection reset by peer")
|
|| (allow_disconnects && a->message() == "Connection reset by peer")
|
||||||
|| (allow_disconnects && a->msg() == "End of file."));
|
|| (allow_disconnects && a->message() == "End of file."));
|
||||||
a = ses.pop_alert();
|
a = ses.pop_alert();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -350,7 +350,7 @@ void test_fastresume()
|
||||||
|
|
||||||
{
|
{
|
||||||
session ses;
|
session ses;
|
||||||
ses.set_severity_level(alert::debug);
|
ses.set_alert_mask(alert::all_categories);
|
||||||
torrent_handle h = ses.add_torrent(t, "tmp1", resume
|
torrent_handle h = ses.add_torrent(t, "tmp1", resume
|
||||||
, storage_mode_compact);
|
, storage_mode_compact);
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ void test_fastresume()
|
||||||
}
|
}
|
||||||
a = ses.pop_alert();
|
a = ses.pop_alert();
|
||||||
assert(a.get());
|
assert(a.get());
|
||||||
std::cerr << a->msg() << std::endl;
|
std::cerr << a->message() << std::endl;
|
||||||
}
|
}
|
||||||
TEST_CHECK(dynamic_cast<fastresume_rejected_alert*>(a.get()) != 0);
|
TEST_CHECK(dynamic_cast<fastresume_rejected_alert*>(a.get()) != 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,9 +52,9 @@ void test_swarm()
|
||||||
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49000, 50000));
|
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49000, 50000));
|
||||||
session ses3(fingerprint("LT", 0, 1, 0, 0), std::make_pair(50000, 51000));
|
session ses3(fingerprint("LT", 0, 1, 0, 0), std::make_pair(50000, 51000));
|
||||||
|
|
||||||
ses1.set_severity_level(alert::debug);
|
ses1.set_alert_mask(alert::all_categories);
|
||||||
ses2.set_severity_level(alert::debug);
|
ses2.set_alert_mask(alert::all_categories);
|
||||||
ses3.set_severity_level(alert::debug);
|
ses3.set_alert_mask(alert::all_categories);
|
||||||
|
|
||||||
// this is to avoid everything finish from a single peer
|
// this is to avoid everything finish from a single peer
|
||||||
// immediately. To make the swarm actually connect all
|
// immediately. To make the swarm actually connect all
|
||||||
|
@ -162,7 +162,7 @@ void test_swarm()
|
||||||
}
|
}
|
||||||
a = ses1.pop_alert();
|
a = ses1.pop_alert();
|
||||||
assert(a.get());
|
assert(a.get());
|
||||||
std::cerr << a->msg() << std::endl;
|
std::cerr << a->message() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CHECK(dynamic_cast<torrent_deleted_alert*>(a.get()) != 0);
|
TEST_CHECK(dynamic_cast<torrent_deleted_alert*>(a.get()) != 0);
|
||||||
|
@ -174,7 +174,7 @@ void test_swarm()
|
||||||
ptime start = time_now();
|
ptime start = time_now();
|
||||||
alert const* ret = ses1.wait_for_alert(seconds(2));
|
alert const* ret = ses1.wait_for_alert(seconds(2));
|
||||||
TEST_CHECK(ret == 0);
|
TEST_CHECK(ret == 0);
|
||||||
if (ret != 0) std::cerr << ret->msg() << std::endl;
|
if (ret != 0) std::cerr << ret->message() << std::endl;
|
||||||
TEST_CHECK(time_now() - start < seconds(3));
|
TEST_CHECK(time_now() - start < seconds(3));
|
||||||
TEST_CHECK(time_now() - start > seconds(2));
|
TEST_CHECK(time_now() - start > seconds(2));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue