fixed iterator bug in disk I/O thread
This commit is contained in:
parent
9a5f5562cb
commit
1ee414f4b9
|
@ -28,6 +28,7 @@
|
||||||
incoming connection
|
incoming connection
|
||||||
* added more detailed instrumentation of the disk I/O thread
|
* added more detailed instrumentation of the disk I/O thread
|
||||||
|
|
||||||
|
* fixed iterator bug in disk I/O thread
|
||||||
* fixed FIEMAP support on linux
|
* fixed FIEMAP support on linux
|
||||||
* fixed strict aliasing warning on gcc
|
* fixed strict aliasing warning on gcc
|
||||||
* fixed inconsistency when creating torrents with symlinks
|
* fixed inconsistency when creating torrents with symlinks
|
||||||
|
|
|
@ -1565,7 +1565,11 @@ namespace libtorrent
|
||||||
m_log << log_time() << " sorting_job" << std::endl;
|
m_log << log_time() << " sorting_job" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
size_type phys_off = j.storage->physical_offset(j.piece, j.offset);
|
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));
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1600,6 +1604,7 @@ namespace libtorrent
|
||||||
if (elevator_direction > 0) ++elevator_job_pos;
|
if (elevator_direction > 0) ++elevator_job_pos;
|
||||||
else --elevator_job_pos;
|
else --elevator_job_pos;
|
||||||
|
|
||||||
|
TORRENT_ASSERT(to_erase != elevator_job_pos);
|
||||||
sorted_read_jobs.erase(to_erase);
|
sorted_read_jobs.erase(to_erase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue