From efead335a949a4d696996c37c3e4566b15c11963 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Tue, 25 Mar 2008 00:09:05 +0000 Subject: [PATCH] Fix saving ratios on quit. --- src/core.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/core.py b/src/core.py index 57a8f3f73..93b715dd5 100644 --- a/src/core.py +++ b/src/core.py @@ -360,14 +360,13 @@ class Manager: def pickle_state(self): print "save uploaded memory" - for unique_ID in self.unique_IDs.keys(): - # self.get_core_torrent_state purposefully not cached. + for torrent in self.state.torrents: + uid = self.state.torrents[torrent] try: - self.unique_IDs[unique_ID].uploaded_memory = \ - self.unique_IDs[unique_ID].initial_uploaded_memory + \ - self.get_core_torrent_state(unique_ID, False)['total_upload'] + torrent.uploaded_memory = self.unique_IDs[uid].uploaded_memory +\ + self.get_core_torrent_state(uid, False)['total_upload'] 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 # available print "Pickling state..."