Fix queue order on restart.

This commit is contained in:
Andrew Resch 2008-05-12 12:41:45 +00:00
parent e7e4651482
commit e70a09b6e4
1 changed files with 3 additions and 1 deletions

View File

@ -304,6 +304,7 @@ class Manager:
# Make sure the Queue is in the correct order and remove any
# entries that were not added to the session due to error.
self.state.queue = state.queue[:]
for uid in state.queue:
if uid not in self.state.torrents:
self.state.queue.remove(uid)
@ -350,7 +351,7 @@ class Manager:
print "save uploaded memory"
import copy
state = persistent_state()
state.queue = self.state.queue
state.queue = self.state.queue[:]
for torrent in self.state.torrents:
uid = self.state.torrents[torrent]
@ -361,6 +362,7 @@ class Manager:
except AttributeError:
t.uploaded_memory = 0
state.torrents[t] = uid
state.queue[state.queue.index(torrent)] = t
# Pickle the state so if we experience a crash, the latest state is
# available