Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix honoring system.file.allocate.set=1 rtorrent config setting #16

Open
chros73 opened this issue May 15, 2017 · 1 comment
Open

Fix honoring system.file.allocate.set=1 rtorrent config setting #16

chros73 opened this issue May 15, 2017 · 1 comment
Labels

Comments

@chros73
Copy link
Owner

chros73 commented May 15, 2017

Fix honoring system.file.allocate.set=1 rtorrent config setting:

  • allocate space for those files only that don't have priority set to off.

It's useful with the following watch directory entry that only loads (in closed state) but not starts torrents, so priority of files can be set.
schedule2 = watch_dir_5, 7, 10, "load.normal=/path/to/watch-dir/load_but_not_start/*.torrent"

@chros73 chros73 added the bug label May 15, 2017
@chros73
Copy link
Owner Author

chros73 commented May 15, 2017

With the previous patch rtorrent could be easily crashed:

  • e.g. when a magnet link was loaded, started and there wasn't enough disk space for it

Modify fixing honoring system.file.allocate.set=1 patch:

  • do not allow to start a torrent if there's not enough disk space for it
    • notify the user about this
  • modify priorities of files as well in libtorrent
  • add 2 new file property in libtorrent:
    • is_fallocatable : if a file has flag_fallocate flag
    • is_fallocatable_file : if a file has flag_fallocate and flag_resize_queued flags
  • modify DownloadList::create() to take into account system.file.allocate setting
  • modify d.update_priorities to be able to pass along file flags
  • refactor DownloadList::resume() a bit

New commands in rtorrent:

  • d.is_enough_diskspace : boolean
  • d.allocatable_size_bytes : size in bytes needed to create the download
  • f.is_fallocatable , : boolean, returns true if a file has flag_fallocate flag
  • f.is_fallocatable_file : boolean, returns true if a file both has flag_fallocate and flag_resize_queued flags
  • f.set_fallocate, f.unset_fallocate : setters for flag_fallocate

Additional fix:

  • fix free_diskspace() method in libtorrent to report back proper size even if a download is stopped

Note:
Unfortunately, this patch isn't complete yet, rtorrent can be still crashed:

  • load a multi file torrent that is larger than free disk space but not start it
  • deselect some files to be able to start download and start it
    • file allocation will be immediate
  • now select some previously deselected files that won't fit on the disk
    • rtorrent will crash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant