fixed web seed test to work with invariant checks turned on and fixed error reporting when receiving an unexpected responce for http seeds

This commit is contained in:
Arvid Norberg
2010-10-30 19:45:50 +00:00
parent a76570b563
commit 0773644a4e
5 changed files with 19 additions and 8 deletions

View File

@@ -869,12 +869,12 @@ void web_server_thread(int* port, bool ssl, bool chunked)
else
{
range_start = 0;
// assume piece size of 16
range_end = 16-1;
// assume piece size of 64kiB
range_end = 64*1024-1;
}
int size = range_end - range_start + 1;
boost::uint64_t off = idx * 16 + range_start;
boost::uint64_t off = idx * 64 * 1024 + range_start;
std::vector<char> file_buf;
int res = load_file("./tmp1_web_seed/seed", file_buf);

View File

@@ -195,6 +195,7 @@ int run_suite(char const* protocol, bool test_url_seed, bool chunked_encoding)
file_storage fs;
std::srand(10);
int piece_size = 16;
if (test_url_seed)
{
int file_sizes[] =
@@ -214,7 +215,8 @@ int run_suite(char const* protocol, bool test_url_seed, bool chunked_encoding)
}
else
{
char random_data[10000];
piece_size = 64 * 1024;
char random_data[64 * 1024 * 50];
std::generate(random_data, random_data + sizeof(random_data), &std::rand);
save_file("./tmp1_web_seed/seed", random_data, sizeof(random_data));
fs.add_file("seed", sizeof(random_data));
@@ -222,7 +224,7 @@ int run_suite(char const* protocol, bool test_url_seed, bool chunked_encoding)
int port = start_web_server(strcmp(protocol, "https") == 0, chunked_encoding);
libtorrent::create_torrent t(fs, 16, 0, libtorrent::create_torrent::calculate_file_hashes);
libtorrent::create_torrent t(fs, piece_size, 0, libtorrent::create_torrent::calculate_file_hashes);
char tmp[512];
if (test_url_seed)
{