Here, at the end of the process, we store resume data for every torrent in the client. Yes, yes, I know... this little script only loads a single torrent. Consider it a bonus for folks writing your own your own clients. A small and obvious bonus, sure, but a bonus all the same.

This is probably the most important place to save resume data because on restore, the last modified times of each file is compared with the times stored in the resume data. If any of them fail to match, all of the resume data is considered invalid.