forked from premiere/premiere-libtorrent
peer_connections stats fix. test_sleep fix. improved test_swarm and test Jamfile
This commit is contained in:
parent
a3e66a3efe
commit
c536ac1990
|
@ -1822,8 +1822,6 @@ namespace libtorrent
|
|||
}
|
||||
}
|
||||
|
||||
m_statistics.second_tick(tick_interval);
|
||||
|
||||
// If the client sends more data
|
||||
// we send it data faster, otherwise, slower.
|
||||
// It will also depend on how much data the
|
||||
|
|
19
test/Jamfile
19
test/Jamfile
|
@ -3,16 +3,23 @@ use-project /torrent : .. ;
|
|||
exe test_upnp : test_upnp.cpp /torrent//torrent
|
||||
: <link>static <threading>multi <logging>verbose <upnp-logging>on ;
|
||||
|
||||
project
|
||||
: requirements
|
||||
lib test_common
|
||||
:
|
||||
main.cpp
|
||||
setup_transfer.cpp
|
||||
:
|
||||
<link>static
|
||||
:
|
||||
<threading>multi
|
||||
<library>/torrent//torrent
|
||||
<source>main.cpp
|
||||
<source>setup_transfer.cpp
|
||||
: default-build
|
||||
<link>static
|
||||
;
|
||||
|
||||
project
|
||||
: requirements
|
||||
<library>test_common
|
||||
;
|
||||
|
||||
|
||||
test-suite libtorrent :
|
||||
[ run test_buffer.cpp ]
|
||||
[ run test_storage.cpp ]
|
||||
|
|
|
@ -15,7 +15,6 @@ void test_sleep(int millisec)
|
|||
{
|
||||
boost::xtime xt;
|
||||
boost::xtime_get(&xt, boost::TIME_UTC);
|
||||
xt.nsec += millisec * 1000000;
|
||||
boost::uint64_t nanosec = (millisec % 1000) * 1000000 + xt.nsec;
|
||||
int sec = millisec / 1000;
|
||||
if (nanosec > 1000000000)
|
||||
|
|
|
@ -22,7 +22,7 @@ void test_swarm()
|
|||
// immediately. To make the swarm actually connect all
|
||||
// three peers before finishing.
|
||||
float rate_limit = 40000;
|
||||
ses1.set_upload_rate_limit(int(rate_limit * 1.1));
|
||||
ses1.set_upload_rate_limit(int(rate_limit));
|
||||
ses2.set_download_rate_limit(int(rate_limit));
|
||||
ses3.set_download_rate_limit(int(rate_limit));
|
||||
ses2.set_upload_rate_limit(int(rate_limit / 2));
|
||||
|
@ -54,7 +54,7 @@ void test_swarm()
|
|||
int count_dl_rates2 = 0;
|
||||
int count_dl_rates3 = 0;
|
||||
|
||||
for (int i = 0; i < 35; ++i)
|
||||
for (int i = 0; i < 60; ++i)
|
||||
{
|
||||
std::auto_ptr<alert> a;
|
||||
a = ses1.pop_alert();
|
||||
|
@ -107,8 +107,8 @@ void test_swarm()
|
|||
std::cerr << "average rate: " << (average2 / 1000.f) << "kB/s - "
|
||||
<< (average3 / 1000.f) << "kB/s" << std::endl;
|
||||
|
||||
// TEST_CHECK(std::fabs(average2 - float(rate_limit)) < 5000.f);
|
||||
// TEST_CHECK(std::fabs(average3 - float(rate_limit)) < 5000.f);
|
||||
TEST_CHECK(std::fabs(average2 - float(rate_limit)) < 3000.f);
|
||||
TEST_CHECK(std::fabs(average3 - float(rate_limit)) < 3000.f);
|
||||
if (tor2.is_seed() && tor3.is_seed()) std::cerr << "done\n";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue