Discussion:
[libtorrent] torrent data flushed to disk upon torrent_finished_alert?
Calum Lind
2017-01-17 18:00:39 UTC
Permalink
Should we expect downloaded torrent data to have been flushed to disk upon
receiving a torrent_finished_alert?

I have a deluge plugin that suspends/shutdowns the computer when a torrent
finishes and a user complained that upon resuming the computer torrents are
not fully complete with a small amount of data transfer still required. I
surmised that the torrent data has not been flushed to disk.

Cheers,Cas
Arvid Norberg
2017-01-17 21:59:35 UTC
Permalink
Post by Calum Lind
Should we expect downloaded torrent data to have been flushed to disk upon
receiving a torrent_finished_alert?
I have a deluge plugin that suspends/shutdowns the computer when a torrent
finishes and a user complained that upon resuming the computer torrents are
not fully complete with a small amount of data transfer still required. I
surmised that the torrent data has not been flushed to disk.
regardless of whether data has been flushed or not at that point, assuming
a clean shutdown, no data should be lost. Even if you hibernate, I would
expect the disk cache to still be there when you wake up again.

that said, no, torrent_finished_alert is posted immediately when it
completes, it does not wait for the disk to flush.

you can explicitly call flush_cache() on the torrent_handle, which will
post back a cache_flushed_alert when it's done, if you'd like.
--
Arvid Norberg
Loading...