factor out disk_buffer_pool from disk_io_thread. refactored the file open modes to be platform independent. gave the disk_io_thread its own copy of session_settings that it shares with storage. added an unaligned_read implementation to storage. Added options to session_settings on when to open files in unbuffered mode. Added unit tests for unaligned reads

This commit is contained in:
Arvid Norberg
2009-01-21 07:31:49 +00:00
parent 9a9f08f70f
commit 00808473e7
11 changed files with 423 additions and 316 deletions

View File

@@ -158,7 +158,7 @@ int test_main()
// calculate the hash for all pieces
int num = t.num_pieces();
std::vector<char> buf(t.piece_length());
char* buf = page_aligned_allocator::malloc(t.piece_length());
file_pool fp;
boost::scoped_ptr<storage_interface> s(default_storage_constructor(
@@ -166,8 +166,8 @@ int test_main()
for (int i = 0; i < num; ++i)
{
s->read(&buf[0], i, 0, fs.piece_size(i));
hasher h(&buf[0], fs.piece_size(i));
s->read(buf, i, 0, fs.piece_size(i));
hasher h(buf, fs.piece_size(i));
t.set_hash(i, h.final());
}
@@ -181,6 +181,7 @@ int test_main()
stop_web_server(8000);
remove_all("./test_torrent_dir");
page_aligned_allocator::free(buf);
return 0;
}