mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-11 02:48:39 +00:00
Fix ratio bug.. yet again
Some possible fastresume fixes too
This commit is contained in:
parent
6a693d10ab
commit
5717fa0d8a
1 changed files with 17 additions and 26 deletions
35
src/core.py
35
src/core.py
|
@ -298,17 +298,6 @@ class Manager:
|
||||||
|
|
||||||
# Apply per torrent prefs after torrent added to core
|
# Apply per torrent prefs after torrent added to core
|
||||||
self.apply_prefs_per_torrent(unique_ID)
|
self.apply_prefs_per_torrent(unique_ID)
|
||||||
#remove fastresume for non-seed
|
|
||||||
try:
|
|
||||||
torrent_state = self.get_core_torrent_state(unique_ID)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
if not torrent_state['is_finished']:
|
|
||||||
try:
|
|
||||||
os.remove(self.unique_IDs[unique_ID].filename + ".fastresume")
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Make sure the Queue is in the correct order and remove any
|
# Make sure the Queue is in the correct order and remove any
|
||||||
# entries that were not added to the session due to error.
|
# entries that were not added to the session due to error.
|
||||||
|
@ -357,17 +346,20 @@ class Manager:
|
||||||
|
|
||||||
def pickle_state(self):
|
def pickle_state(self):
|
||||||
print "save uploaded memory"
|
print "save uploaded memory"
|
||||||
|
import copy
|
||||||
state = persistent_state()
|
state = persistent_state()
|
||||||
state.torrents = dict(self.state.torrents.iteritems())
|
state.queue = self.state.queue
|
||||||
state.queue = self.state.queue[:]
|
|
||||||
|
|
||||||
for torrent in state.torrents:
|
for torrent in self.state.torrents:
|
||||||
uid = state.torrents[torrent]
|
uid = self.state.torrents[torrent]
|
||||||
|
t = copy.copy(torrent)
|
||||||
try:
|
try:
|
||||||
torrent.uploaded_memory = self.unique_IDs[uid].uploaded_memory +\
|
t.uploaded_memory = self.unique_IDs[uid].uploaded_memory +\
|
||||||
self.get_core_torrent_state(uid, False)['total_upload']
|
self.get_core_torrent_state(uid, False)['total_payload_upload']
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
torrent.uploaded_memory = 0
|
t.uploaded_memory = 0
|
||||||
|
state.torrents[t] = uid
|
||||||
|
|
||||||
# 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..."
|
||||||
|
@ -746,11 +738,10 @@ Space:") + " " + nice_free)
|
||||||
self.save_fastresume_data(event['unique_ID'])
|
self.save_fastresume_data(event['unique_ID'])
|
||||||
|
|
||||||
if event['event_type'] is self.constants['EVENT_FINISHED']:
|
if event['event_type'] is self.constants['EVENT_FINISHED']:
|
||||||
|
# save fast resume once torrent finishes so as to not recheck
|
||||||
|
# seed if client crashes
|
||||||
|
self.save_fastresume_data(event['unique_ID'])
|
||||||
if event['message'] == "torrent has finished downloading":
|
if event['message'] == "torrent has finished downloading":
|
||||||
|
|
||||||
# save fast resume once torrent finishes so as to not recheck
|
|
||||||
# seed if client crashes
|
|
||||||
self.save_fastresume_data(event['unique_ID'])
|
|
||||||
self.unique_IDs[event['unique_ID']].seed_time = time.time()
|
self.unique_IDs[event['unique_ID']].seed_time = time.time()
|
||||||
# Queue seeding torrent to bottom if needed
|
# Queue seeding torrent to bottom if needed
|
||||||
if self.get_pref('queue_seeds_to_bottom'):
|
if self.get_pref('queue_seeds_to_bottom'):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue