fixed iterator bug in disk I/O thread

This commit is contained in:
Arvid Norberg 2010-04-14 06:26:38 +00:00
parent 9a5f5562cb
commit 1ee414f4b9
2 changed files with 6 additions and 0 deletions

View File

@ -28,6 +28,7 @@
incoming connection
* added more detailed instrumentation of the disk I/O thread
* fixed iterator bug in disk I/O thread
* fixed FIEMAP support on linux
* fixed strict aliasing warning on gcc
* fixed inconsistency when creating torrents with symlinks

View File

@ -1565,7 +1565,11 @@ namespace libtorrent
m_log << log_time() << " sorting_job" << std::endl;
#endif
size_type phys_off = j.storage->physical_offset(j.piece, j.offset);
bool update_pos = sorted_read_jobs.empty();
sorted_read_jobs.insert(std::pair<size_type, disk_io_job>(phys_off, j));
// if sorted_read_jobs used to be empty,
// we need to update the elevator position
if (update_pos) elevator_job_pos = sorted_read_jobs.begin();
continue;
}
}
@ -1600,6 +1604,7 @@ namespace libtorrent
if (elevator_direction > 0) ++elevator_job_pos;
else --elevator_job_pos;
TORRENT_ASSERT(to_erase != elevator_job_pos);
sorted_read_jobs.erase(to_erase);
}