Fix last by just always deleting the fastresume file before writing a

new one
This commit is contained in:
Andrew Resch 2008-09-06 22:24:35 +00:00
commit 67c0069c7a
2 changed files with 3 additions and 6 deletions

View file

@ -544,6 +544,7 @@ class Torrent:
self.torrent_id) self.torrent_id)
log.debug("Saving fastresume file: %s", path) log.debug("Saving fastresume file: %s", path)
try: try:
self.delete_fastresume()
fastresume = open(path, "wb") fastresume = open(path, "wb")
fastresume.write(resume_data) fastresume.write(resume_data)
fastresume.close() fastresume.close()

View file

@ -563,8 +563,6 @@ class TorrentManager(component.Component):
def save_resume_data(self): def save_resume_data(self):
"""Saves resume data for all the torrents""" """Saves resume data for all the torrents"""
for torrent in self.torrents.values(): for torrent in self.torrents.values():
if not torrent.is_finished:
torrent.delete_fastresume()
torrent.write_fastresume() torrent.write_fastresume()
def queue_top(self, torrent_id): def queue_top(self, torrent_id):
@ -647,8 +645,6 @@ class TorrentManager(component.Component):
component.get("SignalManager").emit("torrent_paused", torrent_id) component.get("SignalManager").emit("torrent_paused", torrent_id)
# Write the fastresume file # Write the fastresume file
if not self.torrents[torrent_id].is_finished:
self.torrents[torrent_id].delete_fastresume()
self.torrents[torrent_id].write_fastresume() self.torrents[torrent_id].write_fastresume()
if torrent_id in self.shutdown_torrent_pause_list: if torrent_id in self.shutdown_torrent_pause_list: