mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-26 10:05:19 +00:00
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()
|
self.state = persistent_state()
|
||||||
|
|
||||||
def quit(self):
|
def quit(self):
|
||||||
|
# Analyze data needed for pickling, etc.
|
||||||
|
self.pre_quitting()
|
||||||
|
|
||||||
# Pickle the prefs
|
# Pickle the prefs
|
||||||
print "Saving prefs..."
|
print "Saving prefs..."
|
||||||
self.config.save()
|
self.config.save()
|
||||||
@ -290,18 +293,6 @@ class Manager:
|
|||||||
deluge_core.quit()
|
deluge_core.quit()
|
||||||
|
|
||||||
def pickle_state(self):
|
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
|
# Pickle the state so if we experience a crash, the latest state is
|
||||||
# available
|
# available
|
||||||
print "Pickling state..."
|
print "Pickling state..."
|
||||||
@ -310,6 +301,13 @@ class Manager:
|
|||||||
pickle.dump(self.state, output)
|
pickle.dump(self.state, output)
|
||||||
output.close()
|
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
|
# Preference management functions
|
||||||
|
|
||||||
def get_config(self):
|
def get_config(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user