forked from premiere/premiere-libtorrent
save and restore storage allocation mode in resume data
This commit is contained in:
parent
8304cb07bc
commit
40f6afc2f8
|
@ -486,11 +486,8 @@ The file format is a bencoded dictionary containing the following fields:
|
|||
| | +-------------+--------------------------------------------+ |
|
||||
| | |
|
||||
+--------------------------+--------------------------------------------------------------+
|
||||
| ``allocation`` | The allocation mode for the storage. Can be either ``full`` |
|
||||
| | or ``compact``. If this is full, the file sizes and |
|
||||
| | timestamps are disregarded. Pieces are assumed not to have |
|
||||
| | moved around even if the files have been modified after the |
|
||||
| | last resume data checkpoint. |
|
||||
| ``allocation`` | The allocation mode for the storage. Can be either |
|
||||
| | ``allocate`` or ``sparse``. |
|
||||
+--------------------------+--------------------------------------------------------------+
|
||||
|
||||
storage allocation
|
||||
|
|
|
@ -68,9 +68,12 @@ namespace libtorrent
|
|||
|
||||
add_torrent_params read_resume_data(bdecode_node const& rd, error_code& ec)
|
||||
{
|
||||
// TODO: 4 where is "allocation" read?
|
||||
|
||||
add_torrent_params ret;
|
||||
if (bdecode_node alloc = rd.dict_find_string("allocation"))
|
||||
{
|
||||
ret.storage_mode = (alloc.string_value() == "allocate"
|
||||
|| alloc.string_value() == "full") ? storage_mode_allocate : storage_mode_sparse;
|
||||
}
|
||||
|
||||
if (rd.dict_find_string_value("file-format")
|
||||
!= "libtorrent resume file")
|
||||
|
|
|
@ -2105,7 +2105,6 @@ namespace libtorrent
|
|||
|
||||
inc_refcount("check_fastresume");
|
||||
// async_check_files will gut links
|
||||
// TODO: 4 check_fastresume should probably be renamed check_files.
|
||||
m_ses.disk_thread().async_check_files(
|
||||
m_storage.get(), m_add_torrent_params ? m_add_torrent_params.get() : NULL
|
||||
, links, boost::bind(&torrent::on_resume_data_checked
|
||||
|
@ -6713,6 +6712,8 @@ namespace libtorrent
|
|||
ret["file-format"] = "libtorrent resume file";
|
||||
ret["file-version"] = 1;
|
||||
ret["libtorrent-version"] = LIBTORRENT_VERSION;
|
||||
ret["allocation"] = m_storage_mode == storage_mode_allocate
|
||||
? "allocate" : "sparse";
|
||||
|
||||
ret["total_uploaded"] = m_total_uploaded;
|
||||
ret["total_downloaded"] = m_total_downloaded;
|
||||
|
|
Loading…
Reference in New Issue