Fix saving ratios on quit.

This commit is contained in:
Andrew Resch 2008-03-25 00:09:05 +00:00
parent 3857a564a1
commit efead335a9

View File

@ -360,14 +360,13 @@ class Manager:
def pickle_state(self): def pickle_state(self):
print "save uploaded memory" print "save uploaded memory"
for unique_ID in self.unique_IDs.keys(): for torrent in self.state.torrents:
# self.get_core_torrent_state purposefully not cached. uid = self.state.torrents[torrent]
try: try:
self.unique_IDs[unique_ID].uploaded_memory = \ torrent.uploaded_memory = self.unique_IDs[uid].uploaded_memory +\
self.unique_IDs[unique_ID].initial_uploaded_memory + \ self.get_core_torrent_state(uid, False)['total_upload']
self.get_core_torrent_state(unique_ID, False)['total_upload']
except AttributeError: except AttributeError:
self.unique_IDs[unique_ID].initial_uploaded_memory = 0 torrent.uploaded_memory = 0
# Pickle the state so if we experience a crash, the latest state is # Pickle the state so if we experience a crash, the latest state is
# available # available
print "Pickling state..." print "Pickling state..."