clean up tests
This commit is contained in:
parent
c9333849e6
commit
20aeed09e1
|
@ -555,7 +555,8 @@ void peer_conn::write_have(int piece)
|
||||||
write_uint32(5, ptr);
|
write_uint32(5, ptr);
|
||||||
write_uint8(4, ptr);
|
write_uint8(4, ptr);
|
||||||
write_uint32(piece, ptr);
|
write_uint32(piece, ptr);
|
||||||
boost::asio::async_write(s, boost::asio::buffer(write_buf_proto, 9), std::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
boost::asio::async_write(s, boost::asio::buffer(write_buf_proto, 9)
|
||||||
|
, std::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void peer_conn::abort()
|
void peer_conn::abort()
|
||||||
|
|
|
@ -105,7 +105,8 @@ struct dht_server
|
||||||
|
|
||||||
int num_hits() const { return m_dht_requests; }
|
int num_hits() const { return m_dht_requests; }
|
||||||
|
|
||||||
static void incoming_packet(error_code const& ec, size_t bytes_transferred, size_t *ret, error_code* error, bool* done)
|
static void incoming_packet(error_code const& ec, size_t bytes_transferred
|
||||||
|
, size_t *ret, error_code* error, bool* done)
|
||||||
{
|
{
|
||||||
*ret = bytes_transferred;
|
*ret = bytes_transferred;
|
||||||
*error = ec;
|
*error = ec;
|
||||||
|
|
|
@ -93,8 +93,7 @@ int main()
|
||||||
, i->mtu
|
, i->mtu
|
||||||
, (i->interface_address.is_multicast()?"multicast ":"")
|
, (i->interface_address.is_multicast()?"multicast ":"")
|
||||||
, (is_local(i->interface_address)?"local ":"")
|
, (is_local(i->interface_address)?"local ":"")
|
||||||
, (is_loopback(i->interface_address)?"loopback ":"")
|
, (is_loopback(i->interface_address)?"loopback ":""));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,10 +112,9 @@ LONG WINAPI seh_exception_handler(LPEXCEPTION_POINTERS p)
|
||||||
print_backtrace(stack_text, sizeof(stack_text), 30
|
print_backtrace(stack_text, sizeof(stack_text), 30
|
||||||
, p->ContextRecord);
|
, p->ContextRecord);
|
||||||
#elif defined __FUNCTION__
|
#elif defined __FUNCTION__
|
||||||
strcat(stack_text, __FUNCTION__);
|
strcpy(stack_text, __FUNCTION__);
|
||||||
#else
|
#else
|
||||||
stack_text[0] = 0;
|
strcpy(stack_text, "<stack traces disabled>");
|
||||||
strcat(stack_text, "<stack traces disabled>");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int const code = p->ExceptionRecord->ExceptionCode;
|
int const code = p->ExceptionRecord->ExceptionCode;
|
||||||
|
@ -166,10 +165,9 @@ void sig_handler(int sig)
|
||||||
|| defined TORRENT_DEBUG_BUFFERS
|
|| defined TORRENT_DEBUG_BUFFERS
|
||||||
print_backtrace(stack_text, sizeof(stack_text), 30);
|
print_backtrace(stack_text, sizeof(stack_text), 30);
|
||||||
#elif defined __FUNCTION__
|
#elif defined __FUNCTION__
|
||||||
strcat(stack_text, __FUNCTION__);
|
strcpy(stack_text, __FUNCTION__);
|
||||||
#else
|
#else
|
||||||
stack_text[0] = 0;
|
strcpy(stack_text, "<stack traces disabled>");
|
||||||
strcat(stack_text, "<stack traces disabled>");
|
|
||||||
#endif
|
#endif
|
||||||
char const* name = "<unknown signal>";
|
char const* name = "<unknown signal>";
|
||||||
switch (sig)
|
switch (sig)
|
||||||
|
@ -287,7 +285,7 @@ EXPORT int main(int argc, char const* argv[])
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// try to suppress hanging the process by windows displaying
|
// try to suppress hanging the process by windows displaying
|
||||||
// modal dialogs.
|
// modal dialogs.
|
||||||
SetErrorMode( SEM_NOALIGNMENTFAULTEXCEPT
|
SetErrorMode(SEM_NOALIGNMENTFAULTEXCEPT
|
||||||
| SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
|
| SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
|
||||||
|
|
||||||
SetUnhandledExceptionFilter(&seh_exception_handler);
|
SetUnhandledExceptionFilter(&seh_exception_handler);
|
||||||
|
|
|
@ -128,7 +128,9 @@ std::shared_ptr<libtorrent::torrent_info> make_test_torrent(
|
||||||
for (int i = 0; i < num_pieces; ++i)
|
for (int i = 0; i < num_pieces; ++i)
|
||||||
{
|
{
|
||||||
hasher h;
|
hasher h;
|
||||||
int const piece_size = (i < num_pieces - 1) ? piece_length : total_size - (num_pieces - 1) * piece_length;
|
int const piece_size = (i < num_pieces - 1)
|
||||||
|
? piece_length
|
||||||
|
: total_size - (num_pieces - 1) * piece_length;
|
||||||
|
|
||||||
char const data = char(i & 0xff);
|
char const data = char(i & 0xff);
|
||||||
char const zero = 0;
|
char const zero = 0;
|
||||||
|
|
|
@ -206,7 +206,8 @@ alert const* wait_for_alert(lt::session& ses, int type, char const* name, int nu
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int load_file(std::string const& filename, std::vector<char>& v, libtorrent::error_code& ec, int limit)
|
int load_file(std::string const& filename, std::vector<char>& v
|
||||||
|
, libtorrent::error_code& ec, int limit)
|
||||||
{
|
{
|
||||||
ec.clear();
|
ec.clear();
|
||||||
FILE* f = fopen(filename.c_str(), "rb");
|
FILE* f = fopen(filename.c_str(), "rb");
|
||||||
|
@ -304,13 +305,12 @@ bool print_alerts(lt::session& ses, char const* name
|
||||||
if (predicate && predicate(a)) ret = true;
|
if (predicate && predicate(a)) ret = true;
|
||||||
if (peer_disconnected_alert const* p = alert_cast<peer_disconnected_alert>(a))
|
if (peer_disconnected_alert const* p = alert_cast<peer_disconnected_alert>(a))
|
||||||
{
|
{
|
||||||
std::printf("%s: %s: [%s] (%s): %s\n", time_now_string(), name, (a)->what()
|
std::printf("%s: %s: [%s] (%s): %s\n", time_now_string(), name, a->what()
|
||||||
, print_endpoint(p->endpoint).c_str(), p->message().c_str());
|
, print_endpoint(p->endpoint).c_str(), p->message().c_str());
|
||||||
}
|
}
|
||||||
else if (should_print(a)
|
else if (should_print(a) && !no_output)
|
||||||
&& !no_output)
|
|
||||||
{
|
{
|
||||||
std::printf("%s: %s: [%s] %s\n", time_now_string(), name, (a)->what(), (a)->message().c_str());
|
std::printf("%s: %s: [%s] %s\n", time_now_string(), name, a->what(), a->message().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CHECK(alert_cast<fastresume_rejected_alert>(a) == nullptr || allow_failed_fastresume);
|
TEST_CHECK(alert_cast<fastresume_rejected_alert>(a) == nullptr || allow_failed_fastresume);
|
||||||
|
@ -466,9 +466,10 @@ pid_type async_run(char const* cmdline)
|
||||||
memset(&startup, 0, sizeof(startup));
|
memset(&startup, 0, sizeof(startup));
|
||||||
startup.cb = sizeof(startup);
|
startup.cb = sizeof(startup);
|
||||||
startup.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
|
startup.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
|
||||||
startup.hStdOutput= GetStdHandle(STD_OUTPUT_HANDLE);
|
startup.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
startup.hStdError = GetStdHandle(STD_INPUT_HANDLE);
|
startup.hStdError = GetStdHandle(STD_INPUT_HANDLE);
|
||||||
int ret = CreateProcessA(NULL, buf, NULL, NULL, TRUE, CREATE_NEW_PROCESS_GROUP, NULL, NULL, &startup, &pi);
|
int ret = CreateProcessA(NULL, buf, NULL, NULL, TRUE
|
||||||
|
, CREATE_NEW_PROCESS_GROUP, NULL, NULL, &startup, &pi);
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
{
|
{
|
||||||
|
@ -799,7 +800,8 @@ setup_transfer(lt::session* ses1, lt::session* ses2, lt::session* ses3
|
||||||
if (ses3) ses3->set_peer_class_filter(f);
|
if (ses3) ses3->set_peer_class_filter(f);
|
||||||
|
|
||||||
settings_pack pack;
|
settings_pack pack;
|
||||||
pack.set_int(settings_pack::alert_mask, ~(alert::progress_notification | alert::stats_notification));
|
pack.set_int(settings_pack::alert_mask
|
||||||
|
, ~(alert::progress_notification | alert::stats_notification));
|
||||||
if (ses3) pack.set_bool(settings_pack::allow_multiple_connections_per_ip, true);
|
if (ses3) pack.set_bool(settings_pack::allow_multiple_connections_per_ip, true);
|
||||||
pack.set_int(settings_pack::mixed_mode_algorithm, settings_pack::prefer_tcp);
|
pack.set_int(settings_pack::mixed_mode_algorithm, settings_pack::prefer_tcp);
|
||||||
pack.set_int(settings_pack::max_failcount, 1);
|
pack.set_int(settings_pack::max_failcount, 1);
|
||||||
|
|
|
@ -46,7 +46,8 @@ namespace libtorrent
|
||||||
EXPORT int print_failures();
|
EXPORT int print_failures();
|
||||||
EXPORT unsigned char random_byte();
|
EXPORT unsigned char random_byte();
|
||||||
|
|
||||||
EXPORT int load_file(std::string const& filename, std::vector<char>& v, libtorrent::error_code& ec, int limit = 8000000);
|
EXPORT int load_file(std::string const& filename, std::vector<char>& v
|
||||||
|
, libtorrent::error_code& ec, int limit = 8000000);
|
||||||
EXPORT void save_file(char const* filename, char const* data, int size);
|
EXPORT void save_file(char const* filename, char const* data, int size);
|
||||||
|
|
||||||
EXPORT void report_failure(char const* err, char const* file, int line);
|
EXPORT void report_failure(char const* err, char const* file, int line);
|
||||||
|
|
|
@ -97,7 +97,8 @@ static void nop() {}
|
||||||
fs.set_piece_length(0x8000); \
|
fs.set_piece_length(0x8000); \
|
||||||
fs.set_num_pieces(5); \
|
fs.set_num_pieces(5); \
|
||||||
test_storage_impl* st = new test_storage_impl; \
|
test_storage_impl* st = new test_storage_impl; \
|
||||||
std::shared_ptr<piece_manager> pm = std::make_shared<piece_manager>(st, std::shared_ptr<int>(new int), &fs); \
|
std::shared_ptr<piece_manager> pm \
|
||||||
|
= std::make_shared<piece_manager>(st, std::shared_ptr<int>(new int), &fs); \
|
||||||
error_code ec; \
|
error_code ec; \
|
||||||
bc.set_settings(sett, ec); \
|
bc.set_settings(sett, ec); \
|
||||||
st->m_settings = &sett; \
|
st->m_settings = &sett; \
|
||||||
|
|
|
@ -109,7 +109,7 @@ void test_to_from_string()
|
||||||
std::string bits_out = filter.to_string();
|
std::string bits_out = filter.to_string();
|
||||||
TEST_EQUAL(memcmp(bits_out.c_str(), bits, 4), 0);
|
TEST_EQUAL(memcmp(bits_out.c_str(), bits, 4), 0);
|
||||||
|
|
||||||
sha1_hash k( "\x01\x00\x02\x00 ");
|
sha1_hash k("\x01\x00\x02\x00 ");
|
||||||
TEST_CHECK(!filter.find(k));
|
TEST_CHECK(!filter.find(k));
|
||||||
filter.set(k);
|
filter.set(k);
|
||||||
TEST_CHECK(filter.find(k));
|
TEST_CHECK(filter.find(k));
|
||||||
|
|
|
@ -46,7 +46,8 @@ namespace lt = libtorrent;
|
||||||
// info-dictionary verbatim, so as to not alter the info-hash
|
// info-dictionary verbatim, so as to not alter the info-hash
|
||||||
TORRENT_TEST(create_verbatim_torrent)
|
TORRENT_TEST(create_verbatim_torrent)
|
||||||
{
|
{
|
||||||
char const test_torrent[] = "d4:infod4:name6:foobar6:lengthi12345e12:piece lengthi65536e6:pieces20:ababababababababababee";
|
char const test_torrent[] = "d4:infod4:name6:foobar6:lengthi12345e"
|
||||||
|
"12:piece lengthi65536e6:pieces20:ababababababababababee";
|
||||||
|
|
||||||
lt::torrent_info info(test_torrent, sizeof(test_torrent) - 1);
|
lt::torrent_info info(test_torrent, sizeof(test_torrent) - 1);
|
||||||
|
|
||||||
|
|
|
@ -68,9 +68,11 @@ namespace {
|
||||||
|
|
||||||
void get_test_keypair(public_key& pk, secret_key& sk)
|
void get_test_keypair(public_key& pk, secret_key& sk)
|
||||||
{
|
{
|
||||||
aux::from_hex({"77ff84905a91936367c01360803104f92432fcd904a43511876df5cdf3e7e548", 64}, pk.bytes.data());
|
aux::from_hex({"77ff84905a91936367c01360803104f92432fcd904a43511876df5cdf3e7e548", 64}
|
||||||
|
, pk.bytes.data());
|
||||||
aux::from_hex({"e06d3183d14159228433ed599221b80bd0a5ce8352e4bdf0262f76786ef1c74d"
|
aux::from_hex({"e06d3183d14159228433ed599221b80bd0a5ce8352e4bdf0262f76786ef1c74d"
|
||||||
"b7e7a9fea2c0eb269d61e3b38e450a22e754941ac78479d6c54e1faf6037881d", 128}, sk.bytes.data());
|
"b7e7a9fea2c0eb269d61e3b38e450a22e754941ac78479d6c54e1faf6037881d", 128}
|
||||||
|
, sk.bytes.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
sequence_number prev_seq(sequence_number s)
|
sequence_number prev_seq(sequence_number s)
|
||||||
|
@ -1078,7 +1080,7 @@ TORRENT_TEST(bloom_filter)
|
||||||
for (int i = 0; i < 256; ++i)
|
for (int i = 0; i < 256; ++i)
|
||||||
{
|
{
|
||||||
char adr[50];
|
char adr[50];
|
||||||
std::snprintf(adr, 50, "192.0.2.%d", i);
|
std::snprintf(adr, sizeof(adr), "192.0.2.%d", i);
|
||||||
address a = addr(adr);
|
address a = addr(adr);
|
||||||
sha1_hash const iphash = hash_address(a);
|
sha1_hash const iphash = hash_address(a);
|
||||||
test.set(iphash);
|
test.set(iphash);
|
||||||
|
@ -1089,7 +1091,7 @@ TORRENT_TEST(bloom_filter)
|
||||||
for (int i = 0; i < 0x3E8; ++i)
|
for (int i = 0; i < 0x3E8; ++i)
|
||||||
{
|
{
|
||||||
char adr[50];
|
char adr[50];
|
||||||
std::snprintf(adr, 50, "2001:db8::%x", i);
|
std::snprintf(adr, sizeof(adr), "2001:db8::%x", i);
|
||||||
address a = addr(adr);
|
address a = addr(adr);
|
||||||
sha1_hash const iphash = hash_address(a);
|
sha1_hash const iphash = hash_address(a);
|
||||||
test.set(iphash);
|
test.set(iphash);
|
||||||
|
@ -1104,12 +1106,44 @@ TORRENT_TEST(bloom_filter)
|
||||||
if (supports_ipv6())
|
if (supports_ipv6())
|
||||||
{
|
{
|
||||||
TEST_CHECK(fabs(test.size() - 1224.93f) < 0.001);
|
TEST_CHECK(fabs(test.size() - 1224.93f) < 0.001);
|
||||||
TEST_CHECK(aux::to_hex(bf_str) == "f6c3f5eaa07ffd91bde89f777f26fb2bff37bdb8fb2bbaa2fd3ddde7bacfff75ee7ccbaefe5eedb1fbfaff67f6abff5e43ddbca3fd9b9ffdf4ffd3e9dff12d1bdf59db53dbe9fa5b7ff3b8fdfcde1afb8bedd7be2f3ee71ebbbfe93bcdeefe148246c2bc5dbff7e7efdcf24fd8dc7adffd8fffdfddfff7a4bbeedf5cb95ce81fc7fcff1ff4ffffdfe5f7fdcbb7fd79b3fa1fc77bfe07fff905b7b7ffc7fefeffe0b8370bb0cd3f5b7f2bd93feb4386cfdd6f7fd5bfaf2e9ebffffeecd67adbf7c67f17efd5d75eba6ffeba7fff47a91eb1bfbb53e8abfb5762abe8ff237279bfefbfeef5ffc5febfdfe5adffadfee1fb737ffffbfd9f6aeffeee76b6fd8f72ef");
|
TEST_CHECK(aux::to_hex(bf_str) ==
|
||||||
|
"f6c3f5eaa07ffd91bde89f777f26fb2b"
|
||||||
|
"ff37bdb8fb2bbaa2fd3ddde7bacfff75"
|
||||||
|
"ee7ccbaefe5eedb1fbfaff67f6abff5e"
|
||||||
|
"43ddbca3fd9b9ffdf4ffd3e9dff12d1b"
|
||||||
|
"df59db53dbe9fa5b7ff3b8fdfcde1afb"
|
||||||
|
"8bedd7be2f3ee71ebbbfe93bcdeefe14"
|
||||||
|
"8246c2bc5dbff7e7efdcf24fd8dc7adf"
|
||||||
|
"fd8fffdfddfff7a4bbeedf5cb95ce81f"
|
||||||
|
"c7fcff1ff4ffffdfe5f7fdcbb7fd79b3"
|
||||||
|
"fa1fc77bfe07fff905b7b7ffc7fefeff"
|
||||||
|
"e0b8370bb0cd3f5b7f2bd93feb4386cf"
|
||||||
|
"dd6f7fd5bfaf2e9ebffffeecd67adbf7"
|
||||||
|
"c67f17efd5d75eba6ffeba7fff47a91e"
|
||||||
|
"b1bfbb53e8abfb5762abe8ff237279bf"
|
||||||
|
"efbfeef5ffc5febfdfe5adffadfee1fb"
|
||||||
|
"737ffffbfd9f6aeffeee76b6fd8f72ef");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TEST_CHECK(fabs(test.size() - 257.854f) < 0.001);
|
TEST_CHECK(fabs(test.size() - 257.854f) < 0.001);
|
||||||
TEST_CHECK(aux::to_hex(bf_str) == "24c0004020043000102012743e00480037110820422110008000c0e302854835a05401a4045021302a306c060001881002d8a0a3a8001901b40a800900310008d2108110c2496a0028700010d804188b01415200082004088026411104a804048002002000080680828c400080cc40020c042c0494447280928041402104080d4240040414a41f0205654800b0811830d2020042b002c5800004a71d0204804a0028120a004c10017801490b834004044106005421000c86900a0020500203510060144e900100924a1018141a028012913f0041802250042280481200002004430804210101c08111c10801001080002038008211004266848606b035001048");
|
TEST_CHECK(aux::to_hex(bf_str) ==
|
||||||
|
"24c0004020043000102012743e004800"
|
||||||
|
"37110820422110008000c0e302854835"
|
||||||
|
"a05401a4045021302a306c0600018810"
|
||||||
|
"02d8a0a3a8001901b40a800900310008"
|
||||||
|
"d2108110c2496a0028700010d804188b"
|
||||||
|
"01415200082004088026411104a80404"
|
||||||
|
"8002002000080680828c400080cc4002"
|
||||||
|
"0c042c0494447280928041402104080d"
|
||||||
|
"4240040414a41f0205654800b0811830"
|
||||||
|
"d2020042b002c5800004a71d0204804a"
|
||||||
|
"0028120a004c10017801490b83400404"
|
||||||
|
"4106005421000c86900a002050020351"
|
||||||
|
"0060144e900100924a1018141a028012"
|
||||||
|
"913f0041802250042280481200002004"
|
||||||
|
"430804210101c08111c1080100108000"
|
||||||
|
"2038008211004266848606b035001048");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2352,9 +2386,11 @@ TORRENT_TEST(mutable_put)
|
||||||
{
|
{
|
||||||
TEST_EQUAL(put_mutable_item_keys[0].string_value(), "q");
|
TEST_EQUAL(put_mutable_item_keys[0].string_value(), "q");
|
||||||
TEST_EQUAL(put_mutable_item_keys[2].string_value(), "put");
|
TEST_EQUAL(put_mutable_item_keys[2].string_value(), "put");
|
||||||
TEST_EQUAL(put_mutable_item_keys[6].string_value(), std::string(pk.bytes.data(), public_key::len));
|
TEST_EQUAL(put_mutable_item_keys[6].string_value()
|
||||||
|
, std::string(pk.bytes.data(), public_key::len));
|
||||||
TEST_EQUAL(put_mutable_item_keys[7].int_value(), int(seq.value));
|
TEST_EQUAL(put_mutable_item_keys[7].int_value(), int(seq.value));
|
||||||
TEST_EQUAL(put_mutable_item_keys[8].string_value(), std::string(sig.bytes.data(), signature::len));
|
TEST_EQUAL(put_mutable_item_keys[8].string_value()
|
||||||
|
, std::string(sig.bytes.data(), signature::len));
|
||||||
span<const char> v = put_mutable_item_keys[10].data_section();
|
span<const char> v = put_mutable_item_keys[10].data_section();
|
||||||
TEST_EQUAL(v.size(), itemv.size());
|
TEST_EQUAL(v.size(), itemv.size());
|
||||||
TEST_CHECK(memcmp(v.data(), itemv.data(), itemv.size()) == 0);
|
TEST_CHECK(memcmp(v.data(), itemv.data(), itemv.size()) == 0);
|
||||||
|
@ -3283,10 +3319,8 @@ TORRENT_TEST(distance_exp)
|
||||||
std::printf("%s %s: %d\n"
|
std::printf("%s %s: %d\n"
|
||||||
, std::get<0>(t), std::get<1>(t), std::get<2>(t));
|
, std::get<0>(t), std::get<1>(t), std::get<2>(t));
|
||||||
|
|
||||||
TEST_EQUAL(distance_exp(
|
TEST_EQUAL(distance_exp(to_hash(std::get<0>(t))
|
||||||
to_hash(std::get<0>(t))
|
, to_hash(std::get<1>(t))), std::get<2>(t));
|
||||||
, to_hash(std::get<1>(t))
|
|
||||||
), std::get<2>(t));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,8 +108,8 @@ TORRENT_TEST(direct_dht_request)
|
||||||
|
|
||||||
entry r;
|
entry r;
|
||||||
r["q"] = "test_good";
|
r["q"] = "test_good";
|
||||||
requester.dht_direct_request(udp::endpoint(address::from_string("127.0.0.1"), responder.listen_port())
|
requester.dht_direct_request(udp::endpoint(address::from_string("127.0.0.1")
|
||||||
, r, (void*)12345);
|
, responder.listen_port()), r, (void*)12345);
|
||||||
|
|
||||||
dht_direct_response_alert* ra = get_direct_response(requester);
|
dht_direct_response_alert* ra = get_direct_response(requester);
|
||||||
TEST_CHECK(ra);
|
TEST_CHECK(ra);
|
||||||
|
|
|
@ -71,8 +71,8 @@ void http_connect_handler(http_connection& c)
|
||||||
++connect_handler_called;
|
++connect_handler_called;
|
||||||
TEST_CHECK(c.socket().is_open());
|
TEST_CHECK(c.socket().is_open());
|
||||||
error_code ec;
|
error_code ec;
|
||||||
std::cout << time_now_string() << " connected to: " << print_endpoint(c.socket().remote_endpoint(ec))
|
std::cout << time_now_string() << " connected to: "
|
||||||
<< std::endl;
|
<< print_endpoint(c.socket().remote_endpoint(ec)) << std::endl;
|
||||||
// this is not necessarily true when using a proxy and proxying hostnames
|
// this is not necessarily true when using a proxy and proxying hostnames
|
||||||
// TEST_CHECK(c.socket().remote_endpoint(ec).address() == address::from_string("127.0.0.1", ec));
|
// TEST_CHECK(c.socket().remote_endpoint(ec).address() == address::from_string("127.0.0.1", ec));
|
||||||
}
|
}
|
||||||
|
@ -128,12 +128,13 @@ void run_test(std::string const& url, int size, int status, int connected
|
||||||
ios.run(e);
|
ios.run(e);
|
||||||
if (e) std::cout << time_now_string() << " run failed: " << e.message() << std::endl;
|
if (e) std::cout << time_now_string() << " run failed: " << e.message() << std::endl;
|
||||||
|
|
||||||
std::cout << time_now_string() << " connect_handler_called: " << connect_handler_called << std::endl;
|
std::string const n = time_now_string();
|
||||||
std::cout << time_now_string() << " handler_called: " << handler_called << std::endl;
|
std::cout << n << " connect_handler_called: " << connect_handler_called << std::endl;
|
||||||
std::cout << time_now_string() << " status: " << http_status << std::endl;
|
std::cout << n << " handler_called: " << handler_called << std::endl;
|
||||||
std::cout << time_now_string() << " size: " << data_size << std::endl;
|
std::cout << n << " status: " << http_status << std::endl;
|
||||||
std::cout << time_now_string() << " expected-size: " << size << std::endl;
|
std::cout << n << " size: " << data_size << std::endl;
|
||||||
std::cout << time_now_string() << " error_code: " << g_error_code.message() << std::endl;
|
std::cout << n << " expected-size: " << size << std::endl;
|
||||||
|
std::cout << n << " error_code: " << g_error_code.message() << std::endl;
|
||||||
TEST_CHECK(connect_handler_called == connected);
|
TEST_CHECK(connect_handler_called == connected);
|
||||||
TEST_CHECK(handler_called == 1);
|
TEST_CHECK(handler_called == 1);
|
||||||
TEST_CHECK(data_size == size || size == -1);
|
TEST_CHECK(data_size == size || size == -1);
|
||||||
|
|
|
@ -175,7 +175,8 @@ TORRENT_TEST(http_parser)
|
||||||
"Host:239.255.255.250:1900\r\n"
|
"Host:239.255.255.250:1900\r\n"
|
||||||
"NT:urn:schemas-upnp-org:device:MediaServer:1\r\n"
|
"NT:urn:schemas-upnp-org:device:MediaServer:1\r\n"
|
||||||
"NTS:ssdp:alive\r\n"
|
"NTS:ssdp:alive\r\n"
|
||||||
"Location:http://10.0.1.15:2353/upnphost/udhisapi.dll?content=uuid:c17f2c31-d19b-4912-af94-651945c8a84e\r\n"
|
"Location:http://10.0.1.15:2353/upnphost/udhisapi.dll?"
|
||||||
|
"content=uuid:c17f2c31-d19b-4912-af94-651945c8a84e\r\n"
|
||||||
"USN:uuid:c17f0c32-d1db-4be8-ae94-25f94583026e::urn:schemas-upnp-org:device:MediaServer:1\r\n"
|
"USN:uuid:c17f0c32-d1db-4be8-ae94-25f94583026e::urn:schemas-upnp-org:device:MediaServer:1\r\n"
|
||||||
"Cache-Control:max-age=900\r\n"
|
"Cache-Control:max-age=900\r\n"
|
||||||
"Server:Microsoft-Windows-NT/5.1 UPnP/1.0 UPnP-Device-Host/1.0\r\n";
|
"Server:Microsoft-Windows-NT/5.1 UPnP/1.0 UPnP-Device-Host/1.0\r\n";
|
||||||
|
|
|
@ -244,7 +244,8 @@ TORRENT_TEST(parse_web_seeds)
|
||||||
// parse_magnet_uri
|
// parse_magnet_uri
|
||||||
error_code ec;
|
error_code ec;
|
||||||
add_torrent_params p;
|
add_torrent_params p;
|
||||||
parse_magnet_uri("magnet:?xt=urn:btih:cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd&ws=http://foo.com/bar&ws=http://bar.com/foo", p, ec);
|
parse_magnet_uri("magnet:?xt=urn:btih:cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
|
||||||
|
"&ws=http://foo.com/bar&ws=http://bar.com/foo", p, ec);
|
||||||
TEST_CHECK(!ec);
|
TEST_CHECK(!ec);
|
||||||
TEST_EQUAL(p.url_seeds.size(), 2);
|
TEST_EQUAL(p.url_seeds.size(), 2);
|
||||||
TEST_EQUAL(p.url_seeds[0], "http://foo.com/bar");
|
TEST_EQUAL(p.url_seeds[0], "http://foo.com/bar");
|
||||||
|
@ -292,7 +293,8 @@ TORRENT_TEST(parse_peer)
|
||||||
{
|
{
|
||||||
error_code ec;
|
error_code ec;
|
||||||
add_torrent_params p;
|
add_torrent_params p;
|
||||||
parse_magnet_uri("magnet:?xt=urn:btih:cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd&dn=foo&x.pe=127.0.0.1:43&x.pe=<invalid1>&x.pe=<invalid2>:100&x.pe=[::1]:45", p, ec);
|
parse_magnet_uri("magnet:?xt=urn:btih:cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
|
||||||
|
"&dn=foo&x.pe=127.0.0.1:43&x.pe=<invalid1>&x.pe=<invalid2>:100&x.pe=[::1]:45", p, ec);
|
||||||
TEST_CHECK(!ec);
|
TEST_CHECK(!ec);
|
||||||
#if TORRENT_USE_IPV6
|
#if TORRENT_USE_IPV6
|
||||||
TEST_EQUAL(p.peers.size(), 2);
|
TEST_EQUAL(p.peers.size(), 2);
|
||||||
|
@ -310,7 +312,8 @@ TORRENT_TEST(parse_dht_node)
|
||||||
{
|
{
|
||||||
error_code ec;
|
error_code ec;
|
||||||
add_torrent_params p;
|
add_torrent_params p;
|
||||||
parse_magnet_uri("magnet:?xt=urn:btih:cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd&dn=foo&dht=127.0.0.1:43", p, ec);
|
parse_magnet_uri("magnet:?xt=urn:btih:cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
|
||||||
|
"&dn=foo&dht=127.0.0.1:43", p, ec);
|
||||||
TEST_CHECK(!ec);
|
TEST_CHECK(!ec);
|
||||||
if (ec) std::printf("%s\n", ec.message().c_str());
|
if (ec) std::printf("%s\n", ec.message().c_str());
|
||||||
ec.clear();
|
ec.clear();
|
||||||
|
@ -326,8 +329,12 @@ TORRENT_TEST(make_magnet_uri)
|
||||||
// make_magnet_uri
|
// make_magnet_uri
|
||||||
entry info;
|
entry info;
|
||||||
info["pieces"] = "aaaaaaaaaaaaaaaaaaaa";
|
info["pieces"] = "aaaaaaaaaaaaaaaaaaaa";
|
||||||
info["name"] = "slightly shorter name, it's kind of sad that people started the trend of incorrectly encoding the regular name field and then adding another one with correct encoding";
|
info["name"] = "slightly shorter name, it's kind of sad that people started "
|
||||||
info["name.utf-8"] = "this is a long ass name in order to try to make make_magnet_uri overflow and hopefully crash. Although, by the time you read this that particular bug should have been fixed";
|
"the trend of incorrectly encoding the regular name field and then adding "
|
||||||
|
"another one with correct encoding";
|
||||||
|
info["name.utf-8"] = "this is a long ass name in order to try to make "
|
||||||
|
"make_magnet_uri overflow and hopefully crash. Although, by the time "
|
||||||
|
"you read this that particular bug should have been fixed";
|
||||||
info["piece length"] = 16 * 1024;
|
info["piece length"] = 16 * 1024;
|
||||||
info["length"] = 3245;
|
info["length"] = 3245;
|
||||||
entry torrent;
|
entry torrent;
|
||||||
|
|
|
@ -86,7 +86,8 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
deadline_timer timer(ios);
|
deadline_timer timer(ios);
|
||||||
|
|
||||||
int const tcp_map = natpmp_handler->add_mapping(portmap_protocol::tcp, atoi(argv[1]), atoi(argv[1]));
|
int const tcp_map = natpmp_handler->add_mapping(portmap_protocol::tcp
|
||||||
|
, atoi(argv[1]), atoi(argv[1]));
|
||||||
natpmp_handler->add_mapping(portmap_protocol::udp, atoi(argv[2]), atoi(argv[2]));
|
natpmp_handler->add_mapping(portmap_protocol::udp, atoi(argv[2]), atoi(argv[2]));
|
||||||
|
|
||||||
error_code ec;
|
error_code ec;
|
||||||
|
|
|
@ -406,7 +406,7 @@ TORRENT_TEST(ip_filter)
|
||||||
|
|
||||||
// now, filter one of the IPs and make sure the peer is removed
|
// now, filter one of the IPs and make sure the peer is removed
|
||||||
ip_filter filter;
|
ip_filter filter;
|
||||||
filter.add_rule(address_v4::from_string("11.0.0.0"), address_v4::from_string("255.255.255.255"), 1);
|
filter.add_rule(addr4("11.0.0.0"), addr4("255.255.255.255"), 1);
|
||||||
std::vector<address> banned;
|
std::vector<address> banned;
|
||||||
p.apply_ip_filter(filter, &st, banned);
|
p.apply_ip_filter(filter, &st, banned);
|
||||||
// we just erased a peer, because it was filtered by the ip filter
|
// we just erased a peer, because it was filtered by the ip filter
|
||||||
|
@ -414,7 +414,7 @@ TORRENT_TEST(ip_filter)
|
||||||
TEST_EQUAL(p.num_connect_candidates(), 0);
|
TEST_EQUAL(p.num_connect_candidates(), 0);
|
||||||
TEST_EQUAL(p.num_peers(), 1);
|
TEST_EQUAL(p.num_peers(), 1);
|
||||||
TEST_EQUAL(banned.size(), 1);
|
TEST_EQUAL(banned.size(), 1);
|
||||||
TEST_EQUAL(banned[0], address_v4::from_string("11.0.0.2"));
|
TEST_EQUAL(banned[0], addr4("11.0.0.2"));
|
||||||
TEST_EQUAL(con2->was_disconnected(), true);
|
TEST_EQUAL(con2->was_disconnected(), true);
|
||||||
TEST_EQUAL(con1->was_disconnected(), false);
|
TEST_EQUAL(con1->was_disconnected(), false);
|
||||||
}
|
}
|
||||||
|
@ -452,7 +452,7 @@ TORRENT_TEST(port_filter)
|
||||||
TEST_EQUAL(p.num_connect_candidates(), 0);
|
TEST_EQUAL(p.num_connect_candidates(), 0);
|
||||||
TEST_EQUAL(p.num_peers(), 1);
|
TEST_EQUAL(p.num_peers(), 1);
|
||||||
TEST_EQUAL(banned.size(), 1);
|
TEST_EQUAL(banned.size(), 1);
|
||||||
TEST_EQUAL(banned[0], address_v4::from_string("11.0.0.2"));
|
TEST_EQUAL(banned[0], addr4("11.0.0.2"));
|
||||||
TEST_EQUAL(con2->was_disconnected(), true);
|
TEST_EQUAL(con2->was_disconnected(), true);
|
||||||
TEST_EQUAL(con1->was_disconnected(), false);
|
TEST_EQUAL(con1->was_disconnected(), false);
|
||||||
}
|
}
|
||||||
|
@ -552,11 +552,10 @@ TORRENT_TEST(set_ip_filter)
|
||||||
|
|
||||||
// trigger the removal of one peer
|
// trigger the removal of one peer
|
||||||
ip_filter filter;
|
ip_filter filter;
|
||||||
filter.add_rule(address_v4::from_string("10.13.0.0")
|
filter.add_rule(addr4("10.13.0.0"), addr4("10.13.255.255"), ip_filter::blocked);
|
||||||
, address_v4::from_string("10.13.255.255"), ip_filter::blocked);
|
|
||||||
p.apply_ip_filter(filter, &st, banned);
|
p.apply_ip_filter(filter, &st, banned);
|
||||||
TEST_EQUAL(st.erased.size(), 1);
|
TEST_EQUAL(st.erased.size(), 1);
|
||||||
TEST_EQUAL(st.erased[0]->address(), address_v4::from_string("10.13.0.0"));
|
TEST_EQUAL(st.erased[0]->address(), addr4("10.13.0.0"));
|
||||||
TEST_EQUAL(p.num_peers(), 99);
|
TEST_EQUAL(p.num_peers(), 99);
|
||||||
TEST_EQUAL(p.num_connect_candidates(), 99);
|
TEST_EQUAL(p.num_connect_candidates(), 99);
|
||||||
}
|
}
|
||||||
|
@ -586,7 +585,7 @@ TORRENT_TEST(set_port_filter)
|
||||||
filter.add_rule(13, 13, port_filter::blocked);
|
filter.add_rule(13, 13, port_filter::blocked);
|
||||||
p.apply_port_filter(filter, &st, banned);
|
p.apply_port_filter(filter, &st, banned);
|
||||||
TEST_EQUAL(st.erased.size(), 1);
|
TEST_EQUAL(st.erased.size(), 1);
|
||||||
TEST_EQUAL(st.erased[0]->address(), address_v4::from_string("10.13.0.0"));
|
TEST_EQUAL(st.erased[0]->address(), addr4("10.13.0.0"));
|
||||||
TEST_EQUAL(st.erased[0]->port, 13);
|
TEST_EQUAL(st.erased[0]->port, 13);
|
||||||
TEST_EQUAL(p.num_peers(), 99);
|
TEST_EQUAL(p.num_peers(), 99);
|
||||||
TEST_EQUAL(p.num_connect_candidates(), 99);
|
TEST_EQUAL(p.num_connect_candidates(), 99);
|
||||||
|
@ -676,8 +675,7 @@ TORRENT_TEST(has_peer)
|
||||||
TEST_EQUAL(p.has_peer(peer2), true);
|
TEST_EQUAL(p.has_peer(peer2), true);
|
||||||
|
|
||||||
ip_filter filter;
|
ip_filter filter;
|
||||||
filter.add_rule(address_v4::from_string("10.10.0.1")
|
filter.add_rule(addr4("10.10.0.1"), addr4("10.10.0.1"), ip_filter::blocked);
|
||||||
, address_v4::from_string("10.10.0.1"), ip_filter::blocked);
|
|
||||||
p.apply_ip_filter(filter, &st, banned);
|
p.apply_ip_filter(filter, &st, banned);
|
||||||
TEST_EQUAL(st.erased.size(), 1);
|
TEST_EQUAL(st.erased.size(), 1);
|
||||||
st.erased.clear();
|
st.erased.clear();
|
||||||
|
|
|
@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/peer_list.hpp"
|
#include "libtorrent/peer_list.hpp"
|
||||||
#include "libtorrent/hasher.hpp"
|
#include "libtorrent/hasher.hpp"
|
||||||
#include "libtorrent/broadcast_socket.hpp" // for supports_ipv6()
|
#include "libtorrent/broadcast_socket.hpp" // for supports_ipv6()
|
||||||
|
#include "setup_transfer.hpp"
|
||||||
#include <boost/crc.hpp>
|
#include <boost/crc.hpp>
|
||||||
|
|
||||||
#include "test.hpp"
|
#include "test.hpp"
|
||||||
|
@ -48,42 +49,31 @@ std::uint32_t hash_buffer(char const* buf, int len)
|
||||||
|
|
||||||
TORRENT_TEST(peer_priority)
|
TORRENT_TEST(peer_priority)
|
||||||
{
|
{
|
||||||
|
|
||||||
// when the IP is the same, we hash the ports, sorted
|
// when the IP is the same, we hash the ports, sorted
|
||||||
std::uint32_t p = peer_priority(
|
std::uint32_t p = peer_priority(
|
||||||
tcp::endpoint(address::from_string("230.12.123.3"), 0x4d2)
|
ep("230.12.123.3", 0x4d2), ep("230.12.123.3", 0x12c));
|
||||||
, tcp::endpoint(address::from_string("230.12.123.3"), 0x12c));
|
|
||||||
TEST_EQUAL(p, hash_buffer("\x01\x2c\x04\xd2", 4));
|
TEST_EQUAL(p, hash_buffer("\x01\x2c\x04\xd2", 4));
|
||||||
|
|
||||||
// when we're in the same /24, we just hash the IPs
|
// when we're in the same /24, we just hash the IPs
|
||||||
p = peer_priority(
|
p = peer_priority(ep("230.12.123.1", 0x4d2), ep("230.12.123.3", 0x12c));
|
||||||
tcp::endpoint(address::from_string("230.12.123.1"), 0x4d2)
|
|
||||||
, tcp::endpoint(address::from_string("230.12.123.3"), 0x12c));
|
|
||||||
TEST_EQUAL(p, hash_buffer("\xe6\x0c\x7b\x01\xe6\x0c\x7b\x03", 8));
|
TEST_EQUAL(p, hash_buffer("\xe6\x0c\x7b\x01\xe6\x0c\x7b\x03", 8));
|
||||||
|
|
||||||
// when we're in the same /16, we just hash the IPs masked by
|
// when we're in the same /16, we just hash the IPs masked by
|
||||||
// 0xffffff55
|
// 0xffffff55
|
||||||
p = peer_priority(
|
p = peer_priority(ep("230.12.23.1", 0x4d2), ep("230.12.123.3", 0x12c));
|
||||||
tcp::endpoint(address::from_string("230.12.23.1"), 0x4d2)
|
|
||||||
, tcp::endpoint(address::from_string("230.12.123.3"), 0x12c));
|
|
||||||
TEST_EQUAL(p, hash_buffer("\xe6\x0c\x17\x01\xe6\x0c\x7b\x01", 8));
|
TEST_EQUAL(p, hash_buffer("\xe6\x0c\x17\x01\xe6\x0c\x7b\x01", 8));
|
||||||
|
|
||||||
// when we're in different /16, we just hash the IPs masked by
|
// when we're in different /16, we just hash the IPs masked by
|
||||||
// 0xffff5555
|
// 0xffff5555
|
||||||
p = peer_priority(
|
p = peer_priority(ep("230.120.23.1", 0x4d2), ep("230.12.123.3", 0x12c));
|
||||||
tcp::endpoint(address::from_string("230.120.23.1"), 0x4d2)
|
|
||||||
, tcp::endpoint(address::from_string("230.12.123.3"), 0x12c));
|
|
||||||
TEST_EQUAL(p, hash_buffer("\xe6\x0c\x51\x01\xe6\x78\x15\x01", 8));
|
TEST_EQUAL(p, hash_buffer("\xe6\x0c\x51\x01\xe6\x78\x15\x01", 8));
|
||||||
|
|
||||||
// test vectors from BEP 40
|
// test vectors from BEP 40
|
||||||
TEST_EQUAL(peer_priority(
|
TEST_EQUAL(peer_priority(ep("123.213.32.10", 0), ep("98.76.54.32", 0))
|
||||||
tcp::endpoint(address::from_string("123.213.32.10"), 0)
|
|
||||||
, tcp::endpoint(address::from_string("98.76.54.32"), 0))
|
|
||||||
, 0xec2d7224);
|
, 0xec2d7224);
|
||||||
|
|
||||||
TEST_EQUAL(peer_priority(
|
TEST_EQUAL(peer_priority(
|
||||||
tcp::endpoint(address::from_string("123.213.32.10"), 0)
|
ep("123.213.32.10", 0), ep("123.213.32.234", 0))
|
||||||
, tcp::endpoint(address::from_string("123.213.32.234"), 0))
|
|
||||||
, 0x99568189);
|
, 0x99568189);
|
||||||
|
|
||||||
if (supports_ipv6())
|
if (supports_ipv6())
|
||||||
|
@ -91,15 +81,13 @@ TORRENT_TEST(peer_priority)
|
||||||
// IPv6 has a twice as wide mask, and we only care about the top 64 bits
|
// IPv6 has a twice as wide mask, and we only care about the top 64 bits
|
||||||
// when the IPs are the same, just hash the ports
|
// when the IPs are the same, just hash the ports
|
||||||
p = peer_priority(
|
p = peer_priority(
|
||||||
tcp::endpoint(address::from_string("ffff:ffff:ffff:ffff::1"), 0x4d2)
|
ep("ffff:ffff:ffff:ffff::1", 0x4d2), ep("ffff:ffff:ffff:ffff::1", 0x12c));
|
||||||
, tcp::endpoint(address::from_string("ffff:ffff:ffff:ffff::1"), 0x12c));
|
|
||||||
TEST_EQUAL(p, hash_buffer("\x01\x2c\x04\xd2", 4));
|
TEST_EQUAL(p, hash_buffer("\x01\x2c\x04\xd2", 4));
|
||||||
|
|
||||||
// these IPs don't belong to the same /32, so apply the full mask
|
// these IPs don't belong to the same /32, so apply the full mask
|
||||||
// 0xffffffff55555555
|
// 0xffffffff55555555
|
||||||
p = peer_priority(
|
p = peer_priority(
|
||||||
tcp::endpoint(address::from_string("ffff:ffff:ffff:ffff::1"), 0x4d2)
|
ep("ffff:ffff:ffff:ffff::1", 0x4d2), ep("ffff:0fff:ffff:ffff::1", 0x12c));
|
||||||
, tcp::endpoint(address::from_string("ffff:0fff:ffff:ffff::1"), 0x12c));
|
|
||||||
TEST_EQUAL(p, hash_buffer(
|
TEST_EQUAL(p, hash_buffer(
|
||||||
"\xff\xff\x0f\xff\x55\x55\x55\x55\x00\x00\x00\x00\x00\x00\x00\x01"
|
"\xff\xff\x0f\xff\x55\x55\x55\x55\x00\x00\x00\x00\x00\x00\x00\x01"
|
||||||
"\xff\xff\xff\xff\x55\x55\x55\x55\x00\x00\x00\x00\x00\x00\x00\x01", 32));
|
"\xff\xff\xff\xff\x55\x55\x55\x55\x00\x00\x00\x00\x00\x00\x00\x01", 32));
|
||||||
|
|
|
@ -498,7 +498,10 @@ TORRENT_TEST(reverse_rarest_first)
|
||||||
, piece_picker::rarest_first | piece_picker::reverse, empty_vector);
|
, piece_picker::rarest_first | piece_picker::reverse, empty_vector);
|
||||||
int expected_common_pieces[] = {3, 2, 5, 0, 6, 4, 1};
|
int expected_common_pieces[] = {3, 2, 5, 0, 6, 4, 1};
|
||||||
for (int i = 0; i < int(picked.size()); ++i)
|
for (int i = 0; i < int(picked.size()); ++i)
|
||||||
TEST_CHECK(picked[i] == piece_block(expected_common_pieces[i / blocks_per_piece], i % blocks_per_piece));
|
{
|
||||||
|
TEST_CHECK(picked[i] == piece_block(expected_common_pieces[i / blocks_per_piece]
|
||||||
|
, i % blocks_per_piece));
|
||||||
|
}
|
||||||
|
|
||||||
// piece 3 should NOT be prioritized since it's a partial, and not
|
// piece 3 should NOT be prioritized since it's a partial, and not
|
||||||
// reversed. Reversed partials are considered reversed
|
// reversed. Reversed partials are considered reversed
|
||||||
|
@ -1884,7 +1887,8 @@ TORRENT_TEST(reprioritize_downloading)
|
||||||
TEST_EQUAL(ret, true);
|
TEST_EQUAL(ret, true);
|
||||||
|
|
||||||
// make sure we _DON'T_ pick the partial piece, since it has priority zero
|
// make sure we _DON'T_ pick the partial piece, since it has priority zero
|
||||||
int const picked_piece = test_pick(p, piece_picker::rarest_first | piece_picker::prioritize_partials);
|
int const picked_piece = test_pick(p, piece_picker::rarest_first
|
||||||
|
| piece_picker::prioritize_partials);
|
||||||
TEST_NE(picked_piece, -1);
|
TEST_NE(picked_piece, -1);
|
||||||
TEST_NE(picked_piece, 0);
|
TEST_NE(picked_piece, 0);
|
||||||
|
|
||||||
|
@ -1894,7 +1898,8 @@ TORRENT_TEST(reprioritize_downloading)
|
||||||
TEST_EQUAL(ret, true);
|
TEST_EQUAL(ret, true);
|
||||||
|
|
||||||
// make sure we pick the partial piece
|
// make sure we pick the partial piece
|
||||||
TEST_EQUAL(test_pick(p, piece_picker::rarest_first | piece_picker::prioritize_partials), 0);
|
TEST_EQUAL(test_pick(p, piece_picker::rarest_first
|
||||||
|
| piece_picker::prioritize_partials), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TORRENT_TEST(reprioritize_fully_downloading)
|
TORRENT_TEST(reprioritize_fully_downloading)
|
||||||
|
@ -1910,7 +1915,8 @@ TORRENT_TEST(reprioritize_fully_downloading)
|
||||||
|
|
||||||
// make sure we _DON'T_ pick the downloading piece
|
// make sure we _DON'T_ pick the downloading piece
|
||||||
{
|
{
|
||||||
int const picked_piece = test_pick(p, piece_picker::rarest_first | piece_picker::prioritize_partials);
|
int const picked_piece = test_pick(p, piece_picker::rarest_first
|
||||||
|
| piece_picker::prioritize_partials);
|
||||||
TEST_NE(picked_piece, -1);
|
TEST_NE(picked_piece, -1);
|
||||||
TEST_NE(picked_piece, 0);
|
TEST_NE(picked_piece, 0);
|
||||||
}
|
}
|
||||||
|
@ -1921,7 +1927,8 @@ TORRENT_TEST(reprioritize_fully_downloading)
|
||||||
|
|
||||||
// make sure we still _DON'T_ pick the downloading piece
|
// make sure we still _DON'T_ pick the downloading piece
|
||||||
{
|
{
|
||||||
int const picked_piece = test_pick(p, piece_picker::rarest_first | piece_picker::prioritize_partials);
|
int const picked_piece = test_pick(p, piece_picker::rarest_first
|
||||||
|
| piece_picker::prioritize_partials);
|
||||||
TEST_NE(picked_piece, -1);
|
TEST_NE(picked_piece, -1);
|
||||||
TEST_NE(picked_piece, 0);
|
TEST_NE(picked_piece, 0);
|
||||||
}
|
}
|
||||||
|
@ -1933,7 +1940,8 @@ TORRENT_TEST(reprioritize_fully_downloading)
|
||||||
|
|
||||||
// make sure we still _DON'T_ pick the downloading piece
|
// make sure we still _DON'T_ pick the downloading piece
|
||||||
{
|
{
|
||||||
int const picked_piece = test_pick(p, piece_picker::rarest_first | piece_picker::prioritize_partials);
|
int const picked_piece = test_pick(p, piece_picker::rarest_first
|
||||||
|
| piece_picker::prioritize_partials);
|
||||||
TEST_NE(picked_piece, -1);
|
TEST_NE(picked_piece, -1);
|
||||||
TEST_NE(picked_piece, 0);
|
TEST_NE(picked_piece, 0);
|
||||||
}
|
}
|
||||||
|
@ -1950,7 +1958,8 @@ TORRENT_TEST(download_filtered_piece)
|
||||||
|
|
||||||
// make sure we _DON'T_ pick piece 0
|
// make sure we _DON'T_ pick piece 0
|
||||||
{
|
{
|
||||||
int const picked_piece = test_pick(p, piece_picker::rarest_first | piece_picker::prioritize_partials);
|
int const picked_piece = test_pick(p, piece_picker::rarest_first
|
||||||
|
| piece_picker::prioritize_partials);
|
||||||
TEST_NE(picked_piece, -1);
|
TEST_NE(picked_piece, -1);
|
||||||
TEST_NE(picked_piece, 0);
|
TEST_NE(picked_piece, 0);
|
||||||
}
|
}
|
||||||
|
@ -1964,7 +1973,8 @@ TORRENT_TEST(download_filtered_piece)
|
||||||
|
|
||||||
{
|
{
|
||||||
// we still should not pick it
|
// we still should not pick it
|
||||||
int const picked_piece = test_pick(p, piece_picker::rarest_first | piece_picker::prioritize_partials);
|
int const picked_piece = test_pick(p, piece_picker::rarest_first
|
||||||
|
| piece_picker::prioritize_partials);
|
||||||
TEST_NE(picked_piece, -1);
|
TEST_NE(picked_piece, -1);
|
||||||
TEST_NE(picked_piece, 0);
|
TEST_NE(picked_piece, 0);
|
||||||
}
|
}
|
||||||
|
@ -1978,4 +1988,5 @@ TORRENT_TEST(download_filtered_piece)
|
||||||
TEST_EQUAL(test_pick(p, piece_picker::rarest_first | piece_picker::prioritize_partials), 0);
|
TEST_EQUAL(test_pick(p, piece_picker::rarest_first | piece_picker::prioritize_partials), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: 2 test picking with partial pieces and other peers present so that both backup_pieces and backup_pieces2 are used
|
//TODO: 2 test picking with partial pieces and other peers present so that both
|
||||||
|
// backup_pieces and backup_pieces2 are used
|
||||||
|
|
|
@ -42,20 +42,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
address_v4 v4(char const* str)
|
|
||||||
{
|
|
||||||
error_code ec;
|
|
||||||
return address_v4::from_string(str, ec);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if TORRENT_USE_IPV6
|
|
||||||
address_v6 v6(char const* str)
|
|
||||||
{
|
|
||||||
error_code ec;
|
|
||||||
return address_v6::from_string(str, ec);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
TORRENT_TEST(primitives)
|
TORRENT_TEST(primitives)
|
||||||
{
|
{
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
@ -82,14 +68,18 @@ TORRENT_TEST(primitives)
|
||||||
|
|
||||||
// test error codes
|
// test error codes
|
||||||
TEST_CHECK(error_code(errors::http_error).message() == "HTTP error");
|
TEST_CHECK(error_code(errors::http_error).message() == "HTTP error");
|
||||||
TEST_CHECK(error_code(errors::missing_file_sizes).message() == "missing or invalid 'file sizes' entry");
|
TEST_CHECK(error_code(errors::missing_file_sizes).message()
|
||||||
TEST_CHECK(error_code(errors::unsupported_protocol_version).message() == "unsupported protocol version");
|
== "missing or invalid 'file sizes' entry");
|
||||||
|
TEST_CHECK(error_code(errors::unsupported_protocol_version).message()
|
||||||
|
== "unsupported protocol version");
|
||||||
TEST_CHECK(error_code(errors::no_i2p_router).message() == "no i2p router is set up");
|
TEST_CHECK(error_code(errors::no_i2p_router).message() == "no i2p router is set up");
|
||||||
TEST_CHECK(error_code(errors::http_parse_error).message() == "Invalid HTTP header");
|
TEST_CHECK(error_code(errors::http_parse_error).message() == "Invalid HTTP header");
|
||||||
TEST_CHECK(error_code(errors::error_code_max).message() == "Unknown error");
|
TEST_CHECK(error_code(errors::error_code_max).message() == "Unknown error");
|
||||||
|
|
||||||
TEST_CHECK(error_code(errors::unauthorized, http_category()).message() == "401 Unauthorized");
|
TEST_CHECK(error_code(errors::unauthorized, http_category()).message()
|
||||||
TEST_CHECK(error_code(errors::service_unavailable, http_category()).message() == "503 Service Unavailable");
|
== "401 Unauthorized");
|
||||||
|
TEST_CHECK(error_code(errors::service_unavailable, http_category()).message()
|
||||||
|
== "503 Service Unavailable");
|
||||||
|
|
||||||
// test std::snprintf
|
// test std::snprintf
|
||||||
|
|
||||||
|
@ -129,9 +119,9 @@ TORRENT_TEST(primitives)
|
||||||
TEST_EQUAL(parse_endpoint(" \t[ff::1]:1214 \r", ec), ep("ff::1", 1214));
|
TEST_EQUAL(parse_endpoint(" \t[ff::1]:1214 \r", ec), ep("ff::1", 1214));
|
||||||
TEST_CHECK(!ec);
|
TEST_CHECK(!ec);
|
||||||
#endif
|
#endif
|
||||||
TEST_EQUAL(print_address(v4("241.124.23.5")), "241.124.23.5");
|
TEST_EQUAL(print_address(addr4("241.124.23.5")), "241.124.23.5");
|
||||||
#if TORRENT_USE_IPV6
|
#if TORRENT_USE_IPV6
|
||||||
TEST_EQUAL(print_address(v6("2001:ff::1")), "2001:ff::1");
|
TEST_EQUAL(print_address(addr6("2001:ff::1")), "2001:ff::1");
|
||||||
parse_endpoint("[ff::1]", ec);
|
parse_endpoint("[ff::1]", ec);
|
||||||
TEST_EQUAL(ec, error_code(errors::invalid_port));
|
TEST_EQUAL(ec, error_code(errors::invalid_port));
|
||||||
#endif
|
#endif
|
||||||
|
@ -140,12 +130,12 @@ TORRENT_TEST(primitives)
|
||||||
TEST_EQUAL(ec, error_code(errors::expected_close_bracket_in_address));
|
TEST_EQUAL(ec, error_code(errors::expected_close_bracket_in_address));
|
||||||
|
|
||||||
// test address_to_bytes
|
// test address_to_bytes
|
||||||
TEST_EQUAL(address_to_bytes(address_v4::from_string("10.11.12.13")), "\x0a\x0b\x0c\x0d");
|
TEST_EQUAL(address_to_bytes(addr4("10.11.12.13")), "\x0a\x0b\x0c\x0d");
|
||||||
TEST_EQUAL(address_to_bytes(address_v4::from_string("16.5.127.1")), "\x10\x05\x7f\x01");
|
TEST_EQUAL(address_to_bytes(addr4("16.5.127.1")), "\x10\x05\x7f\x01");
|
||||||
|
|
||||||
// test endpoint_to_bytes
|
// test endpoint_to_bytes
|
||||||
TEST_EQUAL(endpoint_to_bytes(udp::endpoint(address_v4::from_string("10.11.12.13"), 8080)), "\x0a\x0b\x0c\x0d\x1f\x90");
|
TEST_EQUAL(endpoint_to_bytes(uep("10.11.12.13", 8080)), "\x0a\x0b\x0c\x0d\x1f\x90");
|
||||||
TEST_EQUAL(endpoint_to_bytes(udp::endpoint(address_v4::from_string("16.5.127.1"), 12345)), "\x10\x05\x7f\x01\x30\x39");
|
TEST_EQUAL(endpoint_to_bytes(uep("16.5.127.1", 12345)), "\x10\x05\x7f\x01\x30\x39");
|
||||||
|
|
||||||
// test gen_fingerprint
|
// test gen_fingerprint
|
||||||
TEST_EQUAL(generate_fingerprint("AB", 1, 2, 3, 4), "-AB1234-");
|
TEST_EQUAL(generate_fingerprint("AB", 1, 2, 3, 4), "-AB1234-");
|
||||||
|
|
|
@ -90,7 +90,8 @@ session_proxy test_proxy(settings_pack::proxy_type_t proxy_type, int flags)
|
||||||
// if DHT is disabled, we won't get any requests to it
|
// if DHT is disabled, we won't get any requests to it
|
||||||
flags &= ~expect_dht_msg;
|
flags &= ~expect_dht_msg;
|
||||||
#endif
|
#endif
|
||||||
std::printf("\n=== TEST == proxy: %s anonymous-mode: %s\n\n", proxy_name[proxy_type], (flags & force_proxy_mode) ? "yes" : "no");
|
std::printf("\n=== TEST == proxy: %s anonymous-mode: %s\n\n"
|
||||||
|
, proxy_name[proxy_type], (flags & force_proxy_mode) ? "yes" : "no");
|
||||||
int http_port = start_web_server();
|
int http_port = start_web_server();
|
||||||
int udp_port = start_udp_tracker();
|
int udp_port = start_udp_tracker();
|
||||||
int dht_port = start_dht();
|
int dht_port = start_dht();
|
||||||
|
@ -144,11 +145,13 @@ session_proxy test_proxy(settings_pack::proxy_type_t proxy_type, int flags)
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
char http_tracker_url[200];
|
char http_tracker_url[200];
|
||||||
std::snprintf(http_tracker_url, sizeof(http_tracker_url), "http://127.0.0.1:%d/announce", http_port);
|
std::snprintf(http_tracker_url, sizeof(http_tracker_url)
|
||||||
|
, "http://127.0.0.1:%d/announce", http_port);
|
||||||
t->add_tracker(http_tracker_url, 0);
|
t->add_tracker(http_tracker_url, 0);
|
||||||
|
|
||||||
char udp_tracker_url[200];
|
char udp_tracker_url[200];
|
||||||
std::snprintf(udp_tracker_url, sizeof(udp_tracker_url), "udp://127.0.0.1:%d/announce", udp_port);
|
std::snprintf(udp_tracker_url, sizeof(udp_tracker_url)
|
||||||
|
, "udp://127.0.0.1:%d/announce", udp_port);
|
||||||
t->add_tracker(udp_tracker_url, 1);
|
t->add_tracker(udp_tracker_url, 1);
|
||||||
|
|
||||||
add_torrent_params addp;
|
add_torrent_params addp;
|
||||||
|
@ -191,7 +194,8 @@ session_proxy test_proxy(settings_pack::proxy_type_t proxy_type, int flags)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TEST_EQUAL(num_udp_announces(), prev_udp_announces + ((flags & expect_udp_connection) != 0 ? 1 : 0));
|
TEST_EQUAL(num_udp_announces(), prev_udp_announces
|
||||||
|
+ ((flags & expect_udp_connection) != 0 ? 1 : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & expect_possible_udp_connection)
|
if (flags & expect_possible_udp_connection)
|
||||||
|
@ -222,10 +226,12 @@ session_proxy test_proxy(settings_pack::proxy_type_t proxy_type, int flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & expect_udp_reject)
|
if (flags & expect_udp_reject)
|
||||||
TEST_CHECK(std::find(rejected_trackers.begin(), rejected_trackers.end(), udp_tracker_url) != rejected_trackers.end());
|
TEST_CHECK(std::find(rejected_trackers.begin(), rejected_trackers.end()
|
||||||
|
, udp_tracker_url) != rejected_trackers.end());
|
||||||
|
|
||||||
if (flags & expect_http_reject)
|
if (flags & expect_http_reject)
|
||||||
TEST_CHECK(std::find(rejected_trackers.begin(), rejected_trackers.end(), http_tracker_url) != rejected_trackers.end());
|
TEST_CHECK(std::find(rejected_trackers.begin(), rejected_trackers.end()
|
||||||
|
, http_tracker_url) != rejected_trackers.end());
|
||||||
|
|
||||||
std::printf("%s: ~session\n", time_now_string());
|
std::printf("%s: ~session\n", time_now_string());
|
||||||
session_proxy pr = s->abort();
|
session_proxy pr = s->abort();
|
||||||
|
@ -244,7 +250,8 @@ session_proxy test_proxy(settings_pack::proxy_type_t proxy_type, int flags)
|
||||||
|
|
||||||
TORRENT_TEST(no_proxy)
|
TORRENT_TEST(no_proxy)
|
||||||
{
|
{
|
||||||
test_proxy(settings_pack::none, expect_udp_connection | expect_http_connection | expect_dht_msg | expect_peer_connection);
|
test_proxy(settings_pack::none, expect_udp_connection
|
||||||
|
| expect_http_connection | expect_dht_msg | expect_peer_connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
TORRENT_TEST(socks4)
|
TORRENT_TEST(socks4)
|
||||||
|
@ -254,12 +261,14 @@ TORRENT_TEST(socks4)
|
||||||
|
|
||||||
TORRENT_TEST(socks5)
|
TORRENT_TEST(socks5)
|
||||||
{
|
{
|
||||||
test_proxy(settings_pack::socks5, expect_possible_udp_connection | expect_possible_dht_msg);
|
test_proxy(settings_pack::socks5, expect_possible_udp_connection
|
||||||
|
| expect_possible_dht_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
TORRENT_TEST(socks5_pw)
|
TORRENT_TEST(socks5_pw)
|
||||||
{
|
{
|
||||||
test_proxy(settings_pack::socks5_pw,expect_possible_udp_connection | expect_possible_dht_msg);
|
test_proxy(settings_pack::socks5_pw,expect_possible_udp_connection
|
||||||
|
| expect_possible_dht_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
TORRENT_TEST(http)
|
TORRENT_TEST(http)
|
||||||
|
|
|
@ -458,7 +458,8 @@ TORRENT_TEST(plain_deprecated)
|
||||||
TORRENT_TEST(use_resume_save_path_deprecated)
|
TORRENT_TEST(use_resume_save_path_deprecated)
|
||||||
{
|
{
|
||||||
lt::session ses(settings());
|
lt::session ses(settings());
|
||||||
torrent_status s = test_resume_flags(ses, add_torrent_params::flag_use_resume_save_path, "", "", true).status();
|
torrent_status s = test_resume_flags(ses
|
||||||
|
, add_torrent_params::flag_use_resume_save_path, "", "", true).status();
|
||||||
default_tests(s);
|
default_tests(s);
|
||||||
#ifdef TORRENT_WINDOWS
|
#ifdef TORRENT_WINDOWS
|
||||||
TEST_EQUAL(s.save_path, "c:\\resume_data save_path");
|
TEST_EQUAL(s.save_path, "c:\\resume_data save_path");
|
||||||
|
@ -528,7 +529,8 @@ TORRENT_TEST(seed_mode_deprecated)
|
||||||
TORRENT_TEST(upload_mode_deprecated)
|
TORRENT_TEST(upload_mode_deprecated)
|
||||||
{
|
{
|
||||||
lt::session ses(settings());
|
lt::session ses(settings());
|
||||||
torrent_status s = test_resume_flags(ses, add_torrent_params::flag_upload_mode, "", "", true).status();
|
torrent_status s = test_resume_flags(ses
|
||||||
|
, add_torrent_params::flag_upload_mode, "", "", true).status();
|
||||||
default_tests(s);
|
default_tests(s);
|
||||||
#ifdef TORRENT_WINDOWS
|
#ifdef TORRENT_WINDOWS
|
||||||
TEST_EQUAL(s.save_path, "c:\\add_torrent_params save_path");
|
TEST_EQUAL(s.save_path, "c:\\add_torrent_params save_path");
|
||||||
|
@ -575,7 +577,8 @@ TORRENT_TEST(auto_managed_deprecated)
|
||||||
{
|
{
|
||||||
lt::session ses(settings());
|
lt::session ses(settings());
|
||||||
// resume data overrides the auto-managed flag
|
// resume data overrides the auto-managed flag
|
||||||
torrent_status s = test_resume_flags(ses, add_torrent_params::flag_auto_managed, "", "", true).status();
|
torrent_status s = test_resume_flags(ses
|
||||||
|
, add_torrent_params::flag_auto_managed, "", "", true).status();
|
||||||
default_tests(s);
|
default_tests(s);
|
||||||
#ifdef TORRENT_WINDOWS
|
#ifdef TORRENT_WINDOWS
|
||||||
TEST_EQUAL(s.save_path, "c:\\add_torrent_params save_path");
|
TEST_EQUAL(s.save_path, "c:\\add_torrent_params save_path");
|
||||||
|
|
|
@ -43,52 +43,54 @@ using namespace libtorrent::detail;
|
||||||
TORRENT_TEST(address_to_bytes)
|
TORRENT_TEST(address_to_bytes)
|
||||||
{
|
{
|
||||||
// test address_to_bytes
|
// test address_to_bytes
|
||||||
TEST_EQUAL(address_to_bytes(address_v4::from_string("10.11.12.13")), "\x0a\x0b\x0c\x0d");
|
TEST_EQUAL(address_to_bytes(addr4("10.11.12.13")), "\x0a\x0b\x0c\x0d");
|
||||||
TEST_EQUAL(address_to_bytes(address_v4::from_string("16.5.127.1")), "\x10\x05\x7f\x01");
|
TEST_EQUAL(address_to_bytes(addr4("16.5.127.1")), "\x10\x05\x7f\x01");
|
||||||
|
|
||||||
// test endpoint_to_bytes
|
// test endpoint_to_bytes
|
||||||
TEST_EQUAL(endpoint_to_bytes(udp::endpoint(address_v4::from_string("10.11.12.13"), 8080)), "\x0a\x0b\x0c\x0d\x1f\x90");
|
TEST_EQUAL(endpoint_to_bytes(uep("10.11.12.13", 8080)), "\x0a\x0b\x0c\x0d\x1f\x90");
|
||||||
TEST_EQUAL(endpoint_to_bytes(udp::endpoint(address_v4::from_string("16.5.127.1"), 12345)), "\x10\x05\x7f\x01\x30\x39");
|
TEST_EQUAL(endpoint_to_bytes(uep("16.5.127.1", 12345)), "\x10\x05\x7f\x01\x30\x39");
|
||||||
}
|
}
|
||||||
|
|
||||||
TORRENT_TEST(read_v4_address)
|
TORRENT_TEST(read_v4_address)
|
||||||
{
|
{
|
||||||
std::string buf;
|
std::string buf;
|
||||||
write_address(address_v4::from_string("16.5.128.1"), std::back_inserter(buf));
|
write_address(addr4("16.5.128.1"), std::back_inserter(buf));
|
||||||
TEST_EQUAL(buf, "\x10\x05\x80\x01");
|
TEST_EQUAL(buf, "\x10\x05\x80\x01");
|
||||||
address addr4 = read_v4_address(buf.begin());
|
address addr = read_v4_address(buf.begin());
|
||||||
TEST_EQUAL(addr4, address_v4::from_string("16.5.128.1"));
|
TEST_EQUAL(addr, addr4("16.5.128.1"));
|
||||||
|
|
||||||
buf.clear();
|
buf.clear();
|
||||||
write_endpoint(udp::endpoint(address_v4::from_string("16.5.128.1"), 1337)
|
write_endpoint(uep("16.5.128.1", 1337)
|
||||||
, std::back_inserter(buf));
|
, std::back_inserter(buf));
|
||||||
TEST_EQUAL(buf, "\x10\x05\x80\x01\x05\x39");
|
TEST_EQUAL(buf, "\x10\x05\x80\x01\x05\x39");
|
||||||
udp::endpoint ep4 = read_v4_endpoint<udp::endpoint>(buf.begin());
|
udp::endpoint ep4 = read_v4_endpoint<udp::endpoint>(buf.begin());
|
||||||
TEST_EQUAL(ep4, udp::endpoint(address_v4::from_string("16.5.128.1"), 1337));
|
TEST_EQUAL(ep4, uep("16.5.128.1", 1337));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TORRENT_USE_IPV6
|
#if TORRENT_USE_IPV6
|
||||||
TORRENT_TEST(read_v6_endpoint)
|
TORRENT_TEST(read_v6_endpoint)
|
||||||
{
|
{
|
||||||
std::string buf;
|
std::string buf;
|
||||||
write_address(address_v6::from_string("1000::ffff"), std::back_inserter(buf));
|
write_address(addr6("1000::ffff"), std::back_inserter(buf));
|
||||||
TEST_CHECK(std::equal(buf.begin(), buf.end(), "\x10\0\0\0\0\0\0\0\0\0\0\0\0\0\xff\xff"));
|
TEST_CHECK(std::equal(buf.begin(), buf.end(), "\x10\0\0\0\0\0\0\0\0\0\0\0\0\0\xff\xff"));
|
||||||
address addr6 = read_v6_address(buf.begin());
|
address addr = read_v6_address(buf.begin());
|
||||||
TEST_EQUAL(addr6, address_v6::from_string("1000::ffff"));
|
TEST_EQUAL(addr, addr6("1000::ffff"));
|
||||||
|
|
||||||
buf.clear();
|
buf.clear();
|
||||||
write_endpoint(udp::endpoint(address_v6::from_string("1000::ffff"), 1337)
|
write_endpoint(uep("1000::ffff", 1337)
|
||||||
, std::back_inserter(buf));
|
, std::back_inserter(buf));
|
||||||
TEST_CHECK(std::equal(buf.begin(), buf.end(), "\x10\0\0\0\0\0\0\0\0\0\0\0\0\0\xff\xff\x05\x39"));
|
TEST_CHECK(std::equal(buf.begin(), buf.end()
|
||||||
|
, "\x10\0\0\0\0\0\0\0\0\0\0\0\0\0\xff\xff\x05\x39"));
|
||||||
TEST_EQUAL(buf.size(), 18);
|
TEST_EQUAL(buf.size(), 18);
|
||||||
udp::endpoint ep6 = read_v6_endpoint<udp::endpoint>(buf.begin());
|
udp::endpoint ep6 = read_v6_endpoint<udp::endpoint>(buf.begin());
|
||||||
TEST_EQUAL(ep6, udp::endpoint(address_v6::from_string("1000::ffff"), 1337));
|
TEST_EQUAL(ep6, uep("1000::ffff", 1337));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TORRENT_TEST(read_endpoint_list)
|
TORRENT_TEST(read_endpoint_list)
|
||||||
{
|
{
|
||||||
char const eplist[] = "l6:\x10\x05\x80\x01\x05\x39" "18:\x10\0\0\0\0\0\0\0\0\0\0\0\0\0\xff\xff\x05\x39" "e";
|
char const eplist[] = "l6:\x10\x05\x80\x01\x05\x39"
|
||||||
|
"18:\x10\0\0\0\0\0\0\0\0\0\0\0\0\0\xff\xff\x05\x39" "e";
|
||||||
bdecode_node e;
|
bdecode_node e;
|
||||||
error_code ec;
|
error_code ec;
|
||||||
bdecode(eplist, eplist + sizeof(eplist)-1, e, ec);
|
bdecode(eplist, eplist + sizeof(eplist)-1, e, ec);
|
||||||
|
@ -97,11 +99,11 @@ TORRENT_TEST(read_endpoint_list)
|
||||||
|
|
||||||
#if TORRENT_USE_IPV6
|
#if TORRENT_USE_IPV6
|
||||||
TEST_EQUAL(list.size(), 2);
|
TEST_EQUAL(list.size(), 2);
|
||||||
TEST_EQUAL(list[1], udp::endpoint(address_v6::from_string("1000::ffff"), 1337));
|
TEST_EQUAL(list[1], uep("1000::ffff", 1337));
|
||||||
#else
|
#else
|
||||||
TEST_EQUAL(list.size(), 1);
|
TEST_EQUAL(list.size(), 1);
|
||||||
#endif
|
#endif
|
||||||
TEST_EQUAL(list[0], udp::endpoint(address_v4::from_string("16.5.128.1"), 1337));
|
TEST_EQUAL(list[0], uep("16.5.128.1", 1337));
|
||||||
}
|
}
|
||||||
|
|
||||||
TORRENT_TEST(parse_invalid_ipv4_endpoint)
|
TORRENT_TEST(parse_invalid_ipv4_endpoint)
|
||||||
|
|
|
@ -133,7 +133,8 @@ void test_ssl(int test_idx, bool use_utp)
|
||||||
|
|
||||||
test_config_t const& test = test_config[test_idx];
|
test_config_t const& test = test_config[test_idx];
|
||||||
|
|
||||||
std::printf("\n%s TEST: %s Protocol: %s\n\n", time_now_string(), test.name, use_utp ? "uTP": "TCP");
|
std::printf("\n%s TEST: %s Protocol: %s\n\n", time_now_string()
|
||||||
|
, test.name, use_utp ? "uTP": "TCP");
|
||||||
|
|
||||||
// in case the previous run was terminated
|
// in case the previous run was terminated
|
||||||
error_code ec;
|
error_code ec;
|
||||||
|
@ -291,8 +292,9 @@ void test_ssl(int test_idx, bool use_utp)
|
||||||
std::printf("ssl_disconnects: %d expected: %d\n", ssl_peer_disconnects, test.ssl_disconnects);
|
std::printf("ssl_disconnects: %d expected: %d\n", ssl_peer_disconnects, test.ssl_disconnects);
|
||||||
TEST_EQUAL(ssl_peer_disconnects > 0, test.ssl_disconnects > 0);
|
TEST_EQUAL(ssl_peer_disconnects > 0, test.ssl_disconnects > 0);
|
||||||
|
|
||||||
std::printf("%s: EXPECT: %s\n", time_now_string(), test.expected_to_complete ? "SUCCEESS" : "FAILURE");
|
char const* now = time_now_string();
|
||||||
std::printf("%s: RESULT: %s\n", time_now_string(), tor2.status().is_seeding ? "SUCCEESS" : "FAILURE");
|
std::printf("%s: EXPECT: %s\n", now, test.expected_to_complete ? "SUCCEESS" : "FAILURE");
|
||||||
|
std::printf("%s: RESULT: %s\n", now, tor2.status().is_seeding ? "SUCCEESS" : "FAILURE");
|
||||||
TEST_EQUAL(tor2.status().is_seeding, test.expected_to_complete);
|
TEST_EQUAL(tor2.status().is_seeding, test.expected_to_complete);
|
||||||
|
|
||||||
// this allows shutting down the sessions in parallel
|
// this allows shutting down the sessions in parallel
|
||||||
|
|
|
@ -208,7 +208,8 @@ TORRENT_TEST(escape_string)
|
||||||
// maybe_url_encode
|
// maybe_url_encode
|
||||||
TEST_EQUAL(maybe_url_encode("http://bla.com/\n"), "http://bla.com/%0a");
|
TEST_EQUAL(maybe_url_encode("http://bla.com/\n"), "http://bla.com/%0a");
|
||||||
TEST_EQUAL(maybe_url_encode("http://bla.com/foo%20bar"), "http://bla.com/foo%20bar");
|
TEST_EQUAL(maybe_url_encode("http://bla.com/foo%20bar"), "http://bla.com/foo%20bar");
|
||||||
TEST_EQUAL(maybe_url_encode("http://bla.com/foo%20bar?k=v&k2=v2"), "http://bla.com/foo%20bar?k=v&k2=v2");
|
TEST_EQUAL(maybe_url_encode("http://bla.com/foo%20bar?k=v&k2=v2")
|
||||||
|
, "http://bla.com/foo%20bar?k=v&k2=v2");
|
||||||
TEST_EQUAL(maybe_url_encode("?&"), "?&");
|
TEST_EQUAL(maybe_url_encode("?&"), "?&");
|
||||||
|
|
||||||
// unescape_string
|
// unescape_string
|
||||||
|
@ -238,7 +239,8 @@ TORRENT_TEST(read_until)
|
||||||
TEST_CHECK(read_until(tmp1, 'd', test_string1 + strlen(test_string1)) == "abc");
|
TEST_CHECK(read_until(tmp1, 'd', test_string1 + strlen(test_string1)) == "abc");
|
||||||
|
|
||||||
tmp1 = test_string1;
|
tmp1 = test_string1;
|
||||||
TEST_CHECK(read_until(tmp1, '[', test_string1 + strlen(test_string1)) == "abcdesdf sdgf");
|
TEST_CHECK(read_until(tmp1, '[', test_string1 + strlen(test_string1))
|
||||||
|
== "abcdesdf sdgf");
|
||||||
}
|
}
|
||||||
|
|
||||||
TORRENT_TEST(url_has_argument)
|
TORRENT_TEST(url_has_argument)
|
||||||
|
|
|
@ -159,8 +159,12 @@ TORRENT_TEST(long_names)
|
||||||
{
|
{
|
||||||
entry info;
|
entry info;
|
||||||
info["pieces"] = "aaaaaaaaaaaaaaaaaaaa";
|
info["pieces"] = "aaaaaaaaaaaaaaaaaaaa";
|
||||||
info["name"] = "slightly shorter name, it's kind of sad that people started the trend of incorrectly encoding the regular name field and then adding another one with correct encoding";
|
info["name"] = "slightly shorter name, it's kind of sad that people started "
|
||||||
info["name.utf-8"] = "this is a long ass name in order to try to make make_magnet_uri overflow and hopefully crash. Although, by the time you read this that particular bug should have been fixed";
|
"the trend of incorrectly encoding the regular name field and then adding "
|
||||||
|
"another one with correct encoding";
|
||||||
|
info["name.utf-8"] = "this is a long ass name in order to try to make "
|
||||||
|
"make_magnet_uri overflow and hopefully crash. Although, by the time you "
|
||||||
|
"read this that particular bug should have been fixed";
|
||||||
info["piece length"] = 16 * 1024;
|
info["piece length"] = 16 * 1024;
|
||||||
info["length"] = 3245;
|
info["length"] = 3245;
|
||||||
entry torrent;
|
entry torrent;
|
||||||
|
|
|
@ -162,7 +162,9 @@ test_failing_torrent_t test_error_torrents[] =
|
||||||
// TODO: torrent with 'x' (executable) attribute
|
// TODO: torrent with 'x' (executable) attribute
|
||||||
// TODO: torrent with 'l' (symlink) attribute
|
// TODO: torrent with 'l' (symlink) attribute
|
||||||
// TODO: creating a merkle torrent (torrent_info::build_merkle_list)
|
// TODO: creating a merkle torrent (torrent_info::build_merkle_list)
|
||||||
// TODO: torrent with multiple trackers in multiple tiers, making sure we shuffle them (how do you test shuffling?, load it multiple times and make sure it's in different order at least once)
|
// TODO: torrent with multiple trackers in multiple tiers, making sure we
|
||||||
|
// shuffle them (how do you test shuffling?, load it multiple times and make
|
||||||
|
// sure it's in different order at least once)
|
||||||
// TODO: torrents with a zero-length name
|
// TODO: torrents with a zero-length name
|
||||||
// TODO: torrents with a merkle tree and add_merkle_nodes
|
// TODO: torrents with a merkle tree and add_merkle_nodes
|
||||||
// TODO: torrent with a non-dictionary info-section
|
// TODO: torrent with a non-dictionary info-section
|
||||||
|
@ -232,19 +234,27 @@ TORRENT_TEST(sanitize_long_path)
|
||||||
|
|
||||||
std::string path;
|
std::string path;
|
||||||
sanitize_append_path_element(path,
|
sanitize_append_path_element(path,
|
||||||
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
||||||
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
||||||
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
||||||
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
||||||
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_");
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_");
|
||||||
sanitize_append_path_element(path,
|
sanitize_append_path_element(path,
|
||||||
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
||||||
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
||||||
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
||||||
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
||||||
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcde.test");
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcde.test");
|
||||||
TEST_EQUAL(path,
|
TEST_EQUAL(path,
|
||||||
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
||||||
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
||||||
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
||||||
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
||||||
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_" SEPARATOR
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_" SEPARATOR
|
||||||
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
||||||
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
||||||
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
||||||
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_abcdefghi_"
|
||||||
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_.test");
|
"abcdefghi_abcdefghi_abcdefghi_abcdefghi_.test");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,9 @@ namespace lt = libtorrent;
|
||||||
|
|
||||||
TORRENT_TEST(parse_hostname_peers)
|
TORRENT_TEST(parse_hostname_peers)
|
||||||
{
|
{
|
||||||
char const response[] = "d5:peersld7:peer id20:aaaaaaaaaaaaaaaaaaaa2:ip13:test_hostname4:porti1000eed7:peer id20:bbbbabaababababababa2:ip12:another_host4:porti1001eeee";
|
char const response[] = "d5:peersld7:peer id20:aaaaaaaaaaaaaaaaaaaa"
|
||||||
|
"2:ip13:test_hostname4:porti1000eed"
|
||||||
|
"7:peer id20:bbbbabaababababababa2:ip12:another_host4:porti1001eeee";
|
||||||
error_code ec;
|
error_code ec;
|
||||||
tracker_response resp = parse_tracker_response(response, sizeof(response) - 1
|
tracker_response resp = parse_tracker_response(response, sizeof(response) - 1
|
||||||
, ec, false, sha1_hash());
|
, ec, false, sha1_hash());
|
||||||
|
@ -100,10 +102,10 @@ TORRENT_TEST(parse_peers4)
|
||||||
{
|
{
|
||||||
ipv4_peer_entry const& e0 = resp.peers4[0];
|
ipv4_peer_entry const& e0 = resp.peers4[0];
|
||||||
ipv4_peer_entry const& e1 = resp.peers4[1];
|
ipv4_peer_entry const& e1 = resp.peers4[1];
|
||||||
TEST_CHECK(e0.ip == address_v4::from_string("1.2.3.4").to_bytes());
|
TEST_CHECK(e0.ip == addr4("1.2.3.4").to_bytes());
|
||||||
TEST_EQUAL(e0.port, 0x3010);
|
TEST_EQUAL(e0.port, 0x3010);
|
||||||
|
|
||||||
TEST_CHECK(e1.ip == address_v4::from_string("9.8.7.6").to_bytes());
|
TEST_CHECK(e1.ip == addr4("9.8.7.6").to_bytes());
|
||||||
TEST_EQUAL(e1.port, 0x2010);
|
TEST_EQUAL(e1.port, 0x2010);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,8 +165,10 @@ TORRENT_TEST(parse_i2p_peers)
|
||||||
|
|
||||||
if (resp.peers.size() == 11)
|
if (resp.peers.size() == 11)
|
||||||
{
|
{
|
||||||
TEST_EQUAL(resp.peers[0].hostname, "wgcobfq73pzmtmcttiy2knon5bm2a7gn6j6idaiccf53ikwrecdq.b32.i2p");
|
TEST_EQUAL(resp.peers[0].hostname
|
||||||
TEST_EQUAL(resp.peers[10].hostname, "ufunemgwuun5t2sn3oay4zv7jvwdezwcrirgwr6b2fjgczvaowvq.b32.i2p");
|
, "wgcobfq73pzmtmcttiy2knon5bm2a7gn6j6idaiccf53ikwrecdq.b32.i2p");
|
||||||
|
TEST_EQUAL(resp.peers[10].hostname
|
||||||
|
, "ufunemgwuun5t2sn3oay4zv7jvwdezwcrirgwr6b2fjgczvaowvq.b32.i2p");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +212,8 @@ TORRENT_TEST(parse_failure_reason)
|
||||||
|
|
||||||
TORRENT_TEST(parse_scrape_response)
|
TORRENT_TEST(parse_scrape_response)
|
||||||
{
|
{
|
||||||
char const response[] = "d5:filesd20:aaaaaaaaaaaaaaaaaaaad8:completei1e10:incompletei2e10:downloadedi3e11:downloadersi6eeee";
|
char const response[] = "d5:filesd20:aaaaaaaaaaaaaaaaaaaad"
|
||||||
|
"8:completei1e10:incompletei2e10:downloadedi3e11:downloadersi6eeee";
|
||||||
error_code ec;
|
error_code ec;
|
||||||
tracker_response resp = parse_tracker_response(response, sizeof(response) - 1
|
tracker_response resp = parse_tracker_response(response, sizeof(response) - 1
|
||||||
, ec, true, sha1_hash("aaaaaaaaaaaaaaaaaaaa"));
|
, ec, true, sha1_hash("aaaaaaaaaaaaaaaaaaaa"));
|
||||||
|
@ -222,7 +227,8 @@ TORRENT_TEST(parse_scrape_response)
|
||||||
|
|
||||||
TORRENT_TEST(parse_scrape_response_with_zero)
|
TORRENT_TEST(parse_scrape_response_with_zero)
|
||||||
{
|
{
|
||||||
char const response[] = "d5:filesd20:aaa\0aaaaaaaaaaaaaaaad8:completei4e10:incompletei5e10:downloadedi6eeee";
|
char const response[] = "d5:filesd20:aaa\0aaaaaaaaaaaaaaaad"
|
||||||
|
"8:completei4e10:incompletei5e10:downloadedi6eeee";
|
||||||
error_code ec;
|
error_code ec;
|
||||||
tracker_response resp = parse_tracker_response(response, sizeof(response) - 1
|
tracker_response resp = parse_tracker_response(response, sizeof(response) - 1
|
||||||
, ec, true, sha1_hash("aaa\0aaaaaaaaaaaaaaaa"));
|
, ec, true, sha1_hash("aaa\0aaaaaaaaaaaaaaaa"));
|
||||||
|
@ -243,20 +249,21 @@ TORRENT_TEST(parse_external_ip)
|
||||||
|
|
||||||
TEST_EQUAL(ec, error_code());
|
TEST_EQUAL(ec, error_code());
|
||||||
TEST_EQUAL(resp.peers.size(), 0);
|
TEST_EQUAL(resp.peers.size(), 0);
|
||||||
TEST_EQUAL(resp.external_ip, address_v4::from_string("1.2.3.4"));
|
TEST_EQUAL(resp.external_ip, addr4("1.2.3.4"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TORRENT_USE_IPV6
|
#if TORRENT_USE_IPV6
|
||||||
TORRENT_TEST(parse_external_ip6)
|
TORRENT_TEST(parse_external_ip6)
|
||||||
{
|
{
|
||||||
char const response[] = "d5:peers0:11:external ip16:\xf1\x02\x03\x04\0\0\0\0\0\0\0\0\0\0\xff\xff" "e";
|
char const response[] = "d5:peers0:11:external ip"
|
||||||
|
"16:\xf1\x02\x03\x04\0\0\0\0\0\0\0\0\0\0\xff\xff" "e";
|
||||||
error_code ec;
|
error_code ec;
|
||||||
tracker_response resp = parse_tracker_response(response, sizeof(response) - 1
|
tracker_response resp = parse_tracker_response(response, sizeof(response) - 1
|
||||||
, ec, false, sha1_hash());
|
, ec, false, sha1_hash());
|
||||||
|
|
||||||
TEST_EQUAL(ec, error_code());
|
TEST_EQUAL(ec, error_code());
|
||||||
TEST_EQUAL(resp.peers.size(), 0);
|
TEST_EQUAL(resp.peers.size(), 0);
|
||||||
TEST_EQUAL(resp.external_ip, address_v6::from_string("f102:0304::ffff"));
|
TEST_EQUAL(resp.external_ip, addr6("f102:0304::ffff"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -438,12 +445,12 @@ TORRENT_TEST(http_peers)
|
||||||
h.native_handle()->get_full_peer_list(&peers);
|
h.native_handle()->get_full_peer_list(&peers);
|
||||||
|
|
||||||
std::set<tcp::endpoint> expected_peers;
|
std::set<tcp::endpoint> expected_peers;
|
||||||
expected_peers.insert(tcp::endpoint(address_v4::from_string("65.65.65.65"), 16962));
|
expected_peers.insert(ep("65.65.65.65", 16962));
|
||||||
expected_peers.insert(tcp::endpoint(address_v4::from_string("67.67.67.67"), 17476));
|
expected_peers.insert(ep("67.67.67.67", 17476));
|
||||||
#if TORRENT_USE_IPV6
|
#if TORRENT_USE_IPV6
|
||||||
if (supports_ipv6())
|
if (supports_ipv6())
|
||||||
{
|
{
|
||||||
expected_peers.insert(tcp::endpoint(address_v6::from_string("4545:4545:4545:4545:4545:4545:4545:4545"), 17990));
|
expected_peers.insert(ep("4545:4545:4545:4545:4545:4545:4545:4545", 17990));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -583,7 +590,8 @@ TORRENT_TEST(tracker_proxy)
|
||||||
std::printf("\n\nnot proxying tracker connections (expect to reach the tracker)\n\n");
|
std::printf("\n\nnot proxying tracker connections (expect to reach the tracker)\n\n");
|
||||||
test_proxy(false);
|
test_proxy(false);
|
||||||
|
|
||||||
std::printf("\n\nproxying tracker connections through non-existent proxy (do not expect to reach the tracker)\n\n");
|
std::printf("\n\nproxying tracker connections through non-existent proxy "
|
||||||
|
"(do not expect to reach the tracker)\n\n");
|
||||||
test_proxy(true);
|
test_proxy(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue