mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
move state check for fastresume to be within a try statement to try to catch race condition that happens if a torrent is finished and immediately removed by ratio limit
This commit is contained in:
parent
0c58504f42
commit
5577667631
1 changed files with 14 additions and 21 deletions
35
src/core.py
35
src/core.py
|
@ -462,26 +462,20 @@ class Manager:
|
||||||
def save_fastresume_data(self, uid=None):
|
def save_fastresume_data(self, uid=None):
|
||||||
if uid == None:
|
if uid == None:
|
||||||
for unique_ID in self.unique_IDs:
|
for unique_ID in self.unique_IDs:
|
||||||
state = deluge_core.get_torrent_state(unique_ID)
|
try:
|
||||||
if not state['is_seed'] and state['state'] != 0 and state['state'] != 1:
|
state = deluge_core.get_torrent_state(unique_ID)
|
||||||
try:
|
if not state['is_seed'] and state['state'] != 0 and state['state'] != 1:
|
||||||
os.remove(self.unique_IDs[unique_ID].filename + ".fastresume")
|
os.remove(self.unique_IDs[unique_ID].filename + ".fastresume")
|
||||||
except:
|
deluge_core.save_fastresume(unique_ID, self.unique_IDs[unique_ID].filename)
|
||||||
pass
|
except Exception, e:
|
||||||
try:
|
print "Unable to save fastresume: ", e
|
||||||
deluge_core.save_fastresume(unique_ID, self.unique_IDs[unique_ID].filename)
|
|
||||||
except Exception, e:
|
|
||||||
print "Unable to save fastresume: ", e
|
|
||||||
else:
|
else:
|
||||||
# Do not save fastresume if torrent is Queued for checking or being checked
|
# Do not save fastresume if torrent is Queued for checking or being checked
|
||||||
state = deluge_core.get_torrent_state(uid)
|
|
||||||
if state['state'] == 0 or state['state'] == 1:
|
|
||||||
return
|
|
||||||
try:
|
try:
|
||||||
|
state = deluge_core.get_torrent_state(uid)
|
||||||
|
if state['state'] == 0 or state['state'] == 1:
|
||||||
|
return
|
||||||
os.remove(self.unique_IDs[uid].filename + ".fastresume")
|
os.remove(self.unique_IDs[uid].filename + ".fastresume")
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
deluge_core.save_fastresume(uid, self.unique_IDs[uid].filename)
|
deluge_core.save_fastresume(uid, self.unique_IDs[uid].filename)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print "Unable to save fastresume: ", e
|
print "Unable to save fastresume: ", e
|
||||||
|
@ -742,15 +736,14 @@ Space:") + " " + nice_free)
|
||||||
if event['event_type'] is self.constants['EVENT_FINISHED']:
|
if event['event_type'] is self.constants['EVENT_FINISHED']:
|
||||||
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()
|
||||||
# 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'):
|
||||||
self.queue_bottom(event['unique_ID'])
|
self.queue_bottom(event['unique_ID'])
|
||||||
|
|
||||||
# save fast resume once torrent finishes so as to not recheck
|
|
||||||
# seed if client crashes
|
|
||||||
self.save_fastresume_data(event['unique_ID'])
|
|
||||||
uid = event['unique_ID']
|
|
||||||
self.unique_IDs[uid].seed_time = time.time()
|
|
||||||
|
|
||||||
elif event['event_type'] is self.constants['EVENT_FILE_ERROR']:
|
elif event['event_type'] is self.constants['EVENT_FILE_ERROR']:
|
||||||
import gtk
|
import gtk
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue