mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
upload memory persistency
This commit is contained in:
parent
9e36eb21f5
commit
7b93830260
2 changed files with 14 additions and 4 deletions
|
@ -82,8 +82,8 @@ class torrent_info:
|
||||||
self.save_dir = save_dir
|
self.save_dir = save_dir
|
||||||
self.compact = compact
|
self.compact = compact
|
||||||
|
|
||||||
self.user_paused = False # start out unpaused
|
self.user_paused = False # start out unpaused
|
||||||
self.uploaded_memory = 0
|
self.uploaded_memory = 0
|
||||||
|
|
||||||
self.file_filter = []
|
self.file_filter = []
|
||||||
|
|
||||||
|
@ -172,6 +172,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 "Pickling prefs..."
|
print "Pickling prefs..."
|
||||||
output = open(self.base_dir + "/" + PREFS_FILENAME, 'wb')
|
output = open(self.base_dir + "/" + PREFS_FILENAME, 'wb')
|
||||||
|
@ -197,6 +200,13 @@ class manager:
|
||||||
print "Quitting the core..."
|
print "Quitting the core..."
|
||||||
pytorrent_core.quit()
|
pytorrent_core.quit()
|
||||||
|
|
||||||
|
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.unique_IDs[unique_ID].uploaded_memory = \
|
||||||
|
self.unique_IDs[unique_ID].uploaded_memory + \
|
||||||
|
self.get_torrent_core_state(unique_ID, False)['total_upload'] # Purposefully ineffi.
|
||||||
|
|
||||||
# Preference management functions
|
# Preference management functions
|
||||||
|
|
||||||
def get_pref(self, key):
|
def get_pref(self, key):
|
||||||
|
@ -380,7 +390,7 @@ class manager:
|
||||||
|
|
||||||
# Call this when a session starts, to apply existing filters
|
# Call this when a session starts, to apply existing filters
|
||||||
def apply_all_file_filters(self):
|
def apply_all_file_filters(self):
|
||||||
for unique_ID in unique_IDs.keys():
|
for unique_ID in self.unique_IDs.keys():
|
||||||
try:
|
try:
|
||||||
self.set_file_filter(self.unique_IDs[unique_ID].file_filter)
|
self.set_file_filter(self.unique_IDs[unique_ID].file_filter)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|
|
@ -1168,7 +1168,7 @@ static PyMethodDef pytorrent_core_methods[] = {
|
||||||
{"reannounce", torrent_reannounce, METH_VARARGS, "."},
|
{"reannounce", torrent_reannounce, METH_VARARGS, "."},
|
||||||
{"pause", torrent_pause, METH_VARARGS, "."},
|
{"pause", torrent_pause, METH_VARARGS, "."},
|
||||||
{"resume", torrent_resume, METH_VARARGS, "."},
|
{"resume", torrent_resume, METH_VARARGS, "."},
|
||||||
{"get_torrent_state", torrent_get_torrent_state, METH_VARARGS, "."},
|
{"get_torrent_state", torrent_get_torrent_state, METH_VARARGS, "."},
|
||||||
{"pop_event", torrent_pop_event, METH_VARARGS, "."},
|
{"pop_event", torrent_pop_event, METH_VARARGS, "."},
|
||||||
{"get_session_info", torrent_get_session_info, METH_VARARGS, "."},
|
{"get_session_info", torrent_get_session_info, METH_VARARGS, "."},
|
||||||
{"get_peer_info", torrent_get_peer_info, METH_VARARGS, "."},
|
{"get_peer_info", torrent_get_peer_info, METH_VARARGS, "."},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue