turned file collisions into a runtime error rather than an assert. fixes #14

This commit is contained in:
Arvid Norberg 2007-04-15 07:15:49 +00:00
parent 8dd610bfbd
commit 373263677c
1 changed files with 7 additions and 3 deletions

View File

@ -54,9 +54,13 @@ namespace libtorrent
lru_file_entry e = *i;
e.last_use = time_now();
// if you hit this assert, you probably have more than one
// storage/torrent using the same file at the same time!
assert(e.key == st);
if (e.key != st)
{
// this means that another instance of the storage
// is using the exact same file.
throw file_error("torrent uses the same file as another torrent "
"(" + p.string() + ")");
}
e.key = st;
if ((e.mode & m) != m)