Revert last, needs more thought.
This commit is contained in:
parent
b7c3fddf0e
commit
ff08e28470
22
src/core.py
22
src/core.py
|
@ -271,6 +271,9 @@ class Manager:
|
|||
self.state = persistent_state()
|
||||
|
||||
def quit(self):
|
||||
# Analyze data needed for pickling, etc.
|
||||
self.pre_quitting()
|
||||
|
||||
# Pickle the prefs
|
||||
print "Saving prefs..."
|
||||
self.config.save()
|
||||
|
@ -290,18 +293,6 @@ class Manager:
|
|||
deluge_core.quit()
|
||||
|
||||
def pickle_state(self):
|
||||
# Save the uploaded data from this session to the existing upload
|
||||
# memory
|
||||
for unique_ID in self.unique_IDs:
|
||||
# self.get_core_torrent_state purposefully not cached.
|
||||
#
|
||||
# self.unique_IDs[unique_ID] is a reference to torrent_info
|
||||
# instance in a self.state.torrents array, so changing something
|
||||
# in self.unique_IDs[unique_ID] we also changing it in
|
||||
# self.state.torrents array.
|
||||
self.unique_IDs[unique_ID].uploaded_memory += \
|
||||
self.get_core_torrent_state(unique_ID, False)['total_upload']
|
||||
|
||||
# Pickle the state so if we experience a crash, the latest state is
|
||||
# available
|
||||
print "Pickling state..."
|
||||
|
@ -310,6 +301,13 @@ class Manager:
|
|||
pickle.dump(self.state, output)
|
||||
output.close()
|
||||
|
||||
def pre_quitting(self):
|
||||
# Save the uploaded data from this session to the existing upload memory
|
||||
for unique_ID in self.unique_IDs.keys():
|
||||
# self.get_core_torrent_state purposefully not cached.
|
||||
self.unique_IDs[unique_ID].uploaded_memory += \
|
||||
self.get_core_torrent_state(unique_ID, False)['total_upload']
|
||||
|
||||
# Preference management functions
|
||||
|
||||
def get_config(self):
|
||||
|
|
Loading…
Reference in New Issue